Input
A one-line field with a label, hint and error that trade places, a clear button that folds in, and one shake when an error arrives.
Used forSign-up and settings formsFilters above a tableInline creation rowsDomain and handle fields
Install with the shadcn CLI
Templates
Need the whole page?
43 Next.js landing pages, each designed from scratch. Try any of them live; one is $39, all of them $99, and 5 are free.
Where it’s used
Sign-up and settings forms
Name, email and URL fields with hints that turn into errors in place.
Filters above a table
A clearable field that empties with one press.
Inline creation rows
A compact 28px field inside a toolbar or list row.
Domain and handle fields
Leading and trailing text such as https:// or .com.
What it handles for you
The usual input pushes an error in under itself, moves the layout, and gives no signal when you look away. This one folds the message in, keeps the text still and shakes once.
Hint and error in one line
The hint folds away as the error rises out of a blur, and back when it is fixed.
A clear button that makes room
It opens its own width as you type, so the text never jumps under it.
Accessible by default
Label, aria-invalid and aria-describedby are wired to the right ids.
Works with any form library
Controlled or uncontrolled; onChange and onValueChange both fire, even from the clear button.
Overview
Most inputs swap their hint for an error with a jump and leave the clear button popping in over the text. Here the hairline darkens on hover and turns to the ring on focus, the clear button opens its own width so the text never moves, and an error lifts in where the hint was while the field gives one short shake.
States
- rest
- A hairline pill, 36px or 28px tall; hover darkens the line.
- focus
- The line turns to the ring with a 3px halo (200ms).
- typing
- With clearable, a clear button opens its width as the first letter lands (320ms) and folds away when the field is empty.
- error
- The line turns red, the hint folds away while the error rises from a 4px blur (320ms), and the field shakes once (380ms).
Usage
Props
| Prop | Type | Description |
|---|---|---|
| label | ReactNode | Shown above; becomes the accessible name. |
| hint | ReactNode | Line under the field while there is no error. |
| error | ReactNode | Turns the field red and takes the hint's place. |
| leading / trailing | ReactNode | Icon or text before and after the value. |
| clearable | booleandefault false | A clear button once there is text. |
| size | "sm" | "md"default "md" | 28px or 36px tall. |
| onValueChange | (value: string) => void | The new text on every change. |
| ...input props | InputHTMLAttributes | Everything a native input takes, including ref. |
Accessibility and motion
- Shares field.tsx with every text control: one surface, one focus ring, one way of showing hints and errors.
- Reduced motion: the hint and error change in place and nothing shakes.
- The clear button hands focus back to the field.
Requirements
React 19, Tailwind CSS v4 and shadcn/ui theme variables (any style, light and dark). Icons from lucide-react.
The CLI also installs ui-interaction-motion.
Source
Registry item: /r/input.json


