Field
The wrapper that makes a form accessible without anyone thinking about ids. Put an Input, Select, Checkbox, Switch or OTP input inside a Field and it receives the id, `aria-describedby` for the hint and the error, `aria-invalid` and `required` through context.
The decision inside it
Errors replace hints, they do not stack
A field with a hint and an error under it reads as two messages. When there is an error, it takes the hint's place and the description points at it.
Installation
How you get it
One command. The CLI writes the file into components/ui/ and installs what it needs.
npx shadcn@latest add https://layropro.com/r/fieldAPI
“Copy prompt” above puts a full brief on your clipboard — install command, dependencies, props, and the mistakes an assistant usually makes with this component.
Props
Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.
| Prop | Type | Notes |
|---|---|---|
labelrequired | React.ReactNode | — |
hint | React.ReactNode | One line under the control. Replaced by `error` when there is one. |
error | React.ReactNode | Marks the control invalid and is announced with it. |
optional | boolean | Adds "Optional" beside the label; the rarer case gets the mark. |
required | boolean | — |
inline | boolean | Put the label beside the control instead of above — for checkboxes and switches. |
childrenrequired | React.ReactNode | — |
Dependencies
npm packages
@radix-ui/react-labelclsxtailwind-mergeLayro foundations, installed alongside it
layro-themeLifetime access
Every component, and everything we ship next.
- All 65 components, source included
- The template, and everything released after you buy
- shadcn CLI or download — React 18/19, Tailwind v4
- One payment. No subscription.
More in Forms
Button
FreeSix variants, three sizes, a loading state that keeps its width, and an icon button that insists on a label.
Input
FreeText input with prefix and suffix, plus Password with a reveal toggle and Search that clears on Escape.
Textarea
FreeGrows with its content up to a limit, and shows a counter only when the limit is close.