Fields that belong to one subject: address, billing, profile
Locking a whole section at once
Screen readers should hear the group name before each field
Avoid when
Grouping for looks alone (use Card)
Wrapping one control (use Field)
Implementation notes
Every Fieldset gets a Fieldset.Legend
disabled on the Fieldset locks every control inside it
Put a Grid inside for multi-column layouts
Fieldset.Legend forwards DOM props for ids, ARIA, and data hooks
Installation
pnpm add @usefragments/ui
The npm package stays managed by your package manager. Import styles once from @usefragments/ui/styles. See the installation guide for framework and theme setup.
Anatomy
Import Fieldset once, then compose its parts with dot notation.
Fieldset.Legend
Fieldset.Description
A Grid inside the legend box pairs short fields on one row.
Textarea, select and checkbox share one spacing rhythm.
<Fieldset>
<Fieldset.Legend>Preferences</Fieldset.Legend>
<Field name="bio">
<Field.Label>Bio</Field.Label>
<Field.Control>
<Textarea placeholder="Tell us about yourself" minRows={3} />
With Description
One sentence under the legend covers the whole group.
<Fieldset>
<Fieldset.Legend>Notification Settings</Fieldset.Legend>
<Fieldset.Description>Choose how you want to be notified about updates.</Fieldset.Description>
<Field name="emailNotif">
<Field.Control>
<Checkbox label="Email notifications" />
Disabled
One prop on the wrapper dims and locks every control inside.