Field
The label / description / error scaffold for controls that don't bake it in (Select, custom inputs, radio groups).
Signature
Density
Viewport
Theme and light/dark are set in the top barWhen to use
The label / description / error scaffold for controls that don't bake it in (Select, custom inputs, radio groups).
Accessibility
Always render a visible <label> (the label prop wires htmlFor/id for you). Errors set aria-invalid and are announced via aria-describedby. Required fields expose aria-required.
Install and import
npx shadcn@latest add @prism/field
import { Field } from '@/components/prism/Field';
In a no-build prototype, read it from the bundle instead: const { Field } = window.PrismDesignSystem_39d121;
Props
| Prop | Type | Required | Description |
|---|---|---|---|
label | React.ReactNode | — | |
description | React.ReactNode | — | |
errorMessage | React.ReactNode | — | |
isRequired | boolean | — | |
isInvalid | boolean | — | |
isGroup | boolean | — | The child is a group (checkboxes, a radio set, a ComboBox), so a <label htmlFor> would point at nothing. The label becomes a <span> with an id; a render-function child gets "aria-labelledby", and a plain child is wrapped in a named role="group". |
hint | React.ReactNode | — | Right-aligned secondary note in the label row (e.g. "Optional"). |
id | string | — | |
htmlFor | string | — | |
className | string | — | |
children | React.ReactNode | ((aria: FieldAria) => React.ReactNode) | — |