Input
Inputshadcn/uiWrap it in Field with FieldLabel, FieldDescription and FieldError for forms.
When to use
- Always give a visible FieldLabel in forms; placeholders are examples ('jane@mail.com').
- Show the error after blur or submit, saying how to fix it ('Enter at least 8 characters').
- Use the right type and autoComplete (email, tel, one-time-code).
- Use PasswordInput for every password field, never a bare Input type='password'.
- For a leading icon, wrap in a relative div, place the icon absolutely at left-4 and add pl-11 to the Input.
- Don't use the placeholder as the label.
- Don't show errors while the user is still typing the first time.
Accessibility
- Role
- textbox
- Keyboard
- Tab focuses the field.
- Notes
- Link FieldLabel with htmlFor and the message with aria-describedby.
- Note
- FieldError has role=alert so it is announced.
- Note
- Search fields without a visible label need aria-label.
Props
...input propsReact.ComponentProps<'input'>type, placeholder, value, onChange, autoComplete, aria-invalid…
aria-invalidbooleanError style; pair with FieldError and aria-describedby.
Prompt for your agent
Use the UnbuiltUI Input. Call unbuilt_get_component("Input") first and follow its spec: variants, states, usage rules and accessibility.
unbuilt_get_component returns
2 variants4 states2 props7 usage rules4 a11y notes11 tokens3 examples
Add it with shadcn
$
npx shadcn add https://unbuiltui.com/r/input.jsonTokens · 11
bg.subtlebg.raisedfg.defaultfg.mutedfg.subtleborder.focusdanger.defaultdanger.subtleradius.mdmotion.fastmotion.ease