Mục lục tham khảo

Thành phần

Input

Single-line text field as a 1px ink form line; invalid is a 2px rule; 44px high.

Nội dung tham khảo viết bằng tiếng Anh; mục “Vietnamese” có ví dụ tiếng Việt.

Xem trước

Shown on the front page. Keep it under 70 characters.

Install

bash

npx shadcn add @eloquent/input

Usage

tsx

import { Field, FieldDescription, FieldLabel } from "@/components/ui/field";
import { Input } from "@/components/ui/input";

<Field>
  <FieldLabel>Headline</FieldLabel>
  <Input placeholder="Pragmatic components" />
  <FieldDescription>Shown on the front page.</FieldDescription>
</Field>

Outside a Field, give the input an accessible name with a <label> or aria-label.

States

As printed under the headline.

Choose a desk.
StateTreatment
DefaultPaper fill, ink text, 1px ink bottom rule
HoverNo change; controls change on press or focus only
Focus2px ink outline, 2px offset
Invalid2px ink bottom rule; Field adds the ink ! icon and message
DisabledHalftone text and rule, cursor-not-allowed

Keyboard

KeyAction
Tab / Shift+TabMove focus to and from the input (disabled inputs are skipped)
TypeEdit the value
EnterSubmits the enclosing form

Vietnamese

Hiển thị trên trang nhất. Không quá 70 ký tự.

Ink adaptation

Upstream shadcn's rounded box, border, shadow, focus ring glow and red invalid state are removed. The field is one 1px ink bottom rule, 44px high, set in Barlow. Built on Base UI Input, so it works with Field validation and Form out of the box.