Input
One line of text, such as a name, an email or a search term.
When to use
- One line of free text: a name, an email, a URL, a search term.
When not to use
- Several lines: use Textarea.
- A choice from a known list: use Select, Combobox or Radio Group.
- A date: use Date Picker. A one-time code: use Input OTP.
Install
npx shadcn@latest add @clinia/inputMarketing (Sera)
Clinia rules
- The resting border is the
inputtoken (#8c8c8clight,#777777dark). It clears 3:1, so the field edge stays visible. Don't swap it for theborderhairline. - An invalid field always comes with error text that says what to fix. The destructive border alone is not enough.
- The text is
text-basebelow 768px andmd:text-smabove, so a size you pass applies to small screens only. Pass themd:size too:text-body-m md:text-body-m.
Do and don't
Enter a full email, such as billing@clinic.ca.
States: product (Luma)
placeholder
filled
focus
invalid
disabled
read-only
Focus cells apply the component's focus-visible classes statically. Toggle the site theme to review both themes.
States: marketing (Sera)
placeholder
filled
focus
invalid
disabled
read-only
Focus cells apply the component's focus-visible classes statically. Toggle the site theme to review both themes.
Accessibility
Built in
- Focus-visible shows a solid Trust ring (
border-ring ring-3 ring-ring/30);aria-invalidswaps it to a destructive ring. - The resting border is the
inputtoken, which clears 3:1 on the page and on cards in both themes.
Your responsibility
- Give every input a visible label:
FieldLabelinsideField, orLabelwithhtmlForset to the input'sid. - On error, set
aria-invalidand pointaria-describedbyat theFieldError, so the message is read with the field. - Set
typeandautoComplete(email,tel,one-time-code) so browsers and password managers can help.
How to test
- Click the label: focus moves to the input.
- Press Tab into the field: the Trust ring appears.
- Make it invalid: the border turns destructive, and a screen reader reads the error after the label.
- Zoom to 200%: the text and the border stay visible and nothing is clipped.
API
Every prop comes from Base UI Input.