Validated form on each framework's form library (React Hook Form, VeeValidate, Angular reactive forms): its form, field, item, label, control, description and message parts auto-wire ids and aria-* across each field.
Compound API for composable forms: form, field, item, label, control, description and message (PixelForm.Root + .Field + … in React, PixelForm + PixelFormField + … in Vue, form[pxlForm] + [pxlFormField] + … in Angular).
Auto-generates linked ids and wires aria-describedby + aria-invalid on the controlled field.
Built on each framework's form library — React Hook Form, VeeValidate, Angular reactive forms — so any control it binds works: value/onChange/ref in React, v-model in Vue, a ControlValueAccessor in Angular.
The message shows the field error, as an alert, while there is one; in React and Vue, content you give it shows instead.
Surface-aware: a surface on the form, label, description or message follows kit-wide design tokens.
Status
stable
Category
forms
Since
v1.8.0
API
import { PixelForm } from '@pxlkit/ui-kit';
PixelForm
Prop
Type
Default
Description
form* (required)
UseFormReturn<T>
—
The form: what React Hook Form's useForm returns.
onSubmit* (required)
(data: T) => void | Promise<void>
—
Called with the form's values, once a submission finds no error.
children* (required)
React.ReactNode
—
The fields.
className
string
—
Extra classes on the <form>.
surface
'pixel' | 'linear'
—
Surface override; defaults to the nearest provider.
Renders the control: gets the field's props (field: its value, change and blur handlers, name and ref) and its state (fieldState).
PixelForm.Item
Prop
Type
Default
Description
children* (required)
React.ReactNode
—
PixelForm.Label, PixelForm.Control, PixelForm.Description and PixelForm.Message.
Also takes the native attributes and event handlers of <div> (HTMLAttributes<HTMLDivElement>).
ref points to <div>.
PixelForm.Label
Prop
Type
Default
Description
surface
'pixel' | 'linear'
—
Surface override; defaults to the nearest provider.
Also takes the native attributes and event handlers of <label> (LabelHTMLAttributes<HTMLLabelElement>).
ref points to <label>.
PixelForm.Control
Prop
Type
Default
Description
children* (required)
React.ReactElement
—
The control: one element, which gets the field's id, aria-describedby and aria-invalid.
ref points to its element (HTMLElement).
PixelForm.Description
Prop
Type
Default
Description
surface
'pixel' | 'linear'
—
Surface override; defaults to the nearest provider.
Also takes the native attributes and event handlers of <p> (HTMLAttributes<HTMLParagraphElement>).
ref points to <p>.
PixelForm.Message
Prop
Type
Default
Description
surface
'pixel' | 'linear'
—
Surface override; defaults to the nearest provider.
Also takes the native attributes and event handlers of <p> (HTMLAttributes<HTMLParagraphElement>).
ref points to <p>.
Accessibility
WCAG target: 2.1 AA
form
labelled-control
Each item generates a stable id base and links the label (for), the control (id + aria-describedby + aria-invalid), the description (id) and the message (id, role="alert" on error) automatically — authors do not pass ids manually.