Field
Lightweight wrapper primitives for composing labels, controls, helper text, and errors.
Use the name people recognize in your workspace.
Installation
npx @glass-ui-kit/cli add fieldUsage
Examples
Default
Use Field as the canonical native-first composition helper for one logical field. Add layout classes yourself so stacked inputs and checkbox rows can use the same API.
Use the name people recognize in your workspace.
Error State
Set invalid on Field when the field should propagate aria-invalid to the control.
We'll only use this for account notifications.
Please enter a valid email address.
Textarea
The same pattern works for multiline fields too.
Keep it concise. You can edit this later.
Styling
Field stays layout-agnostic. It provides lightweight context for generated ids, label binding, and aria-describedby wiring. Use className for layout and invalid for error state.
API Reference
| Prop | Type |
|---|---|
invalid | boolean |
className | string |
Field also accepts standard div props. FieldDescription and FieldError accept standard paragraph props, and FieldError defaults to role="alert".