Combine labels, controls, and help text to compose accessible form fields and grouped inputs.
Installation
Usage
<FieldSet>
<FieldLegend>Profile</FieldLegend>
<FieldDescription>This appears on invoices and emails.</FieldDescription>
<FieldGroup>
<Field>
<FieldLabel for="name">Full name</FieldLabel>
<Input id="name" autocomplete="off" placeholder="Evil Rabbit" />
<FieldDescription>This appears on invoices and emails.</FieldDescription>
</Field>
<Field>
<FieldLabel for="username">Username</FieldLabel>
<Input id="username" autocomplete="off" aria-invalid="true" />
<FieldError>Choose another username.</FieldError>
</Field>
<Field Orientation="FieldOrientation.Horizontal">
<Switch id="newsletter" />
<FieldLabel for="newsletter">Subscribe to the newsletter</FieldLabel>
</Field>
</FieldGroup>
</FieldSet>Composition
Field
A single control with label, helper text, and validation.
Field
├── FieldLabel
├── Input / Textarea / Switch / Select
├── FieldDescription
└── FieldErrorFieldGroup
Related fields in one group. Use FieldSeparator between sections when needed.
FieldGroup
├── Field
│ ├── FieldLabel
│ ├── Input / Textarea / Switch / Select
│ ├── FieldDescription
│ └── FieldError
├── FieldSeparator
└── Field
├── FieldLabel
└── Input / Textarea / Switch / SelectFieldSet
Semantic grouping with a legend and description, usually containing a FieldGroup.
FieldSet
├── FieldLegend
├── FieldDescription
└── FieldGroup
├── Field
│ ├── FieldLabel
│ ├── Input / Textarea / Switch / Select
│ ├── FieldDescription
│ └── FieldError
└── Field
├── FieldLabel
└── Input / Textarea / Switch / SelectAnatomy
The Field family is designed for composing accessible forms. A typical field is structured as follows, with its control (an Input, Select, Switch and so on) after the label:
<Field>
<FieldLabel for="input-id">Label</FieldLabel>
<Input id="input-id" />
<FieldDescription>Optional helper text.</FieldDescription>
<FieldError>Validation message.</FieldError>
</Field>Fieldis the core wrapper for a single field.FieldContentis a flex column that groups label and description. Not required if you have no description.- Wrap related fields with
FieldGroup, and useFieldSetwithFieldLegendfor semantic grouping.
Form
Use it inside an EditForm or a plain <form>: Field only lays out and labels the controls.
Input
Textarea
Select
Select your department or area of work.
Slider
Set your budget range ($200 - 800).
Fieldset
Checkbox
Your Desktop & Documents folders are being synced with iCloud Drive. You can access them from other devices.
Radio
Switch
Choice Card
Wrap Field components inside FieldLabel to create selectable field groups. This works with RadioItem, Checkbox and Switch components.
Field Group
Stack Field components with FieldGroup. Add FieldSeparator to divide them.
Responsive Layout
- Vertical fields: Default orientation stacks label, control, and helper text—ideal for mobile-first layouts.
- Horizontal fields: Set
orientation="horizontal"onFieldto align the label and control side-by-side. Pair withFieldContentto keep descriptions aligned. - Responsive fields: Set
orientation="responsive"for automatic column layouts inside container-aware parents. Apply@container/field-groupclasses onFieldGroupto switch orientations at specific breakpoints.
Validation and Errors
- Add
data-invalidtoFieldto switch the entire block into an error state. - Add
aria-invalidon the input itself for assistive technologies. - Render
FieldErrorimmediately after the control or insideFieldContentto keep error messages aligned with the field.
<Field data-invalid="true">
<FieldLabel for="email">Email</FieldLabel>
<Input id="email" Type="email" aria-invalid="true" />
<FieldError>Enter a valid email address.</FieldError>
</Field>Accessibility
FieldSetandFieldLegendkeep related controls grouped for keyboard and assistive tech users.Fieldoutputsrole="group"so nested controls inherit labeling fromFieldLabelandFieldLegendwhen combined.- Apply
FieldSeparatorsparingly to ensure screen readers encounter clear section boundaries.
RTL
To enable RTL support in Blazix, see the RTL configuration guide.
Translated with AI for the demo, so it may have mistakes.
API Reference
Field
Other attributes are passed to the element it renders.
FieldContent
Other attributes are passed to the element it renders.
FieldDescription
Other attributes are passed to the element it renders.
FieldError
Other attributes are passed to the element it renders.
FieldGroup
Other attributes are passed to the element it renders.
FieldLabel
Other attributes are passed to the element it renders.
FieldLegend
Other attributes are passed to the element it renders.
FieldSeparator
Other attributes are passed to the element it renders.
FieldSet
Other attributes are passed to the element it renders.
FieldTitle
Other attributes are passed to the element it renders.