Form Field

Label + control + error/hint wiring for any input; includes Label.

FormField is the wiring component: a Label, your control, and inline feedback — error (in text-destructive) or hint (in text-muted-foreground), never both. This page also covers Label, which FormField uses internally.

Installation

import { FormField, Label } from "@iammikz/srui";

Usage

We'll never share your email.

FormField props

PropTypeDefaultDescription
labelstring—Field label
htmlForstring—Associates label + control (id on the control)
errorstring—Error text; takes precedence over hint
hintstring—Helper text
childrenReactNode—The Input / Select / Textarea / … control

Label

Label wraps @radix-ui/react-label: htmlFor association, peer-disabled styling. Use it directly for controls that manage their own layout:

Examples

Error state

Accessibility

Label → control association via htmlFor/id gives every control an accessible name. The error message renders with role="alert" so it is announced when it appears; pair it with invalid on the control for aria-invalid.