Default
A label and a field. What you type is blue felt; the placeholder is graphite.
A one-line text field: a pencil box on paper around a real <input>, with blue felt for what you type. It draws its own hover, focus ring, invalid (red pencil and a !), disabled (dashes) and read-only (printed) states.
npx shadcn@latest add @wobko/input第一次使用?先把 registry 加进 components.json。 如何安装
A label and a field. What you type is blue felt; the placeholder is graphite.
Filled, invalid (red pencil, a wavy underline and a !), disabled (dashed pencil) and read-only (printed). Hover and Tab into them to see the rest.
Password, number, search, date and file. The number spinners and the search clear button are removed; the file button is a highlighter swatch.
className goes to the frame, but padding goes to the input: pl-9 makes room for the pencilled magnifier exactly as it would on a plain shadcn input.
Real validation: the email field turns red with its message the moment it is wrong, and the form only submits when it is right.
shadcn's `input-demo`: the bare Input, nothing around it. `type="email"` and a placeholder are all it takes; what you type comes out in blue felt.
shadcn's `input-disabled`: `disabled` draws the box in dashed pencil and takes the field out of the tab order and out of the form.
shadcn's `input-file`: `type="file"` under a label. The native picker button becomes a highlighter swatch; the file name is the field's own text.
shadcn's `input-with-button`: an Input and an outline Button side by side in a flex row. Two separate drawings that line up, not one shared box (InputGroup does that).
shadcn's `input-with-label`: a Label above the field in a grid, tied to it by `htmlFor` and `id`, so a click on the word puts the cursor in the box.
shadcn's `input-with-text`: a line of muted help under the field. Here it is joined to the input with `aria-describedby`, which the original leaves to you.
A <span data-slot="input-frame"> (the drawn box: it owns the size, the drawing and the state) around <input data-slot="input">. Everything you pass goes to the <input>, as in shadcn, and ref is the input. className and style go to the frame, so width, height, margin, flex and grid placement, font size and text color work as they always did; padding, resize-* and variants like placeholder: or file: are moved onto the input, which keeps the whole box clickable and the text inset exactly as in shadcn.
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| className | string | - | Classes for the frame (layout, height, font, text color). Padding utilities and control-only variants (placeholder:, file:, selection:, autofill:, focus:, disabled:) are applied to the <input> instead. |
| inputClassName | string | - | Classes appended to the <input> itself, after the ones moved there from className. |
| seed | string | number | - | Pins the hand: the same seed always draws the same box, also across remounts. Default: derived from useId(). |
| disabled | boolean | false | A real disabled input, drawn as dashed pencil on a pale wash. Under a disabled <fieldset> the input is still disabled, but the box is not redrawn. |
| readOnly | boolean | false | Focusable and selectable, drawn as a printed field: a pale wash and one quiet pencil line, no hover. |
| aria-invalid | boolean | "true" | "false" | - | true draws the red-pencil box, the wavy underline and the ! mark (and reserves room for it at the end of the line). Set it from your validation, as with shadcn. |
CLI 会复制进你项目的文件。
正在加载源码