InputNew
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
Older shadcn CLI, or a network that blocks ui.shadcn.com? Install by URL: shadcn add https://hairlineui.com/r/input.json. More
Used in 9 blocks
All blocks- BookingBook a call on one card: the time you pick prints onto the host’s ticket, then the times turn into your details and the confirmation.
- CartA cart whose receipt does the maths in front of you: codes are stamped on, a rail of light fills toward free shipping and every total rolls.
- Buy boxA product buy box whose swatches repaint the product: pick a colour and size, and Add to bag throws the product into the bag.
- CheckoutA one-page checkout whose steps stack into a receipt: contact, address, delivery and your payment element, then Place order turns into the order number.
Templates
Need the whole page?
65 Next.js landing pages, each designed from scratch. Try any of them live; one is $39, all of them $159, and 8 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
Works with
Built on it
- BookingBook a call on one card: the time you pick prints onto the host’s ticket, then the times turn into your details and the confirmation.
- CartA cart whose receipt does the maths in front of you: codes are stamped on, a rail of light fills toward free shipping and every total rolls.
- Buy boxA product buy box whose swatches repaint the product: pick a colour and size, and Add to bag throws the product into the bag.
- CheckoutA one-page checkout whose steps stack into a receipt: contact, address, delivery and your payment element, then Place order turns into the order number.
- File shareDrop files, watch them upload, and they fold into one share link with an expiry and an optional password.
- Delete workspaceA danger-zone delete with a ghost: as you type the name, Boo climbs out of the workspace’s tile, and holding Delete waves him off the stage.
- Not foundA 404 with a search and a puppy: Fetch sniffs as you type, sprints off to fetch the results and comes back with a newspaper, or a stick.
- WaitlistA waitlist that is an actual line: you step in at the end with your number over your head, and every friend who joins lets you hop past the person ahead.
- UsernameA username picker with a penguin holding a sign: your name appears on it as you type; if it’s taken, its smug owner slides in hugging a sign with your name on it.
Props
- 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= false
- boolean
- A clear button once there is text.
- size= "md"
- "sm" | "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.
Source
Registry item: /r/input.json


