Fieldset
Group related form fields under a shared legend.
Installation
pnpm dlx shadcn@4.18.0 add @siteplane/fieldsetComplete the one-time setup first. Registry JSON lists source files and dependencies.
For this page’s examples, also install:
pnpm dlx shadcn@4.18.0 add @siteplane/input @siteplane/radio-groupUsage
import {
Fieldset,
FieldsetDescription,
FieldsetLegend,
} from "@/siteplane/components/fieldset";
<Fieldset>
<FieldsetLegend>Profile</FieldsetLegend>
<FieldsetDescription>
Your profile is visible to your team.
</FieldsetDescription>
</Fieldset>;Composition
Fieldset
├── FieldsetLegend
├── FieldsetDescription (optional)
├── Field
└── FieldDescription
Add FieldsetDescription for a hint the whole group shares, such as who sees the details. Its text takes the size and colour of a Card description. The Fieldset names it in aria-describedby, so a screen reader reads it when focus enters the group, together with any description id you pass yourself. A hint for one field belongs in that Field's FieldDescription.
Disabled group
Disable the group when the fields are unavailable. This is distinct from a group of read-only values.
Choice group
Render a Field as the Fieldset to give a radio group a legend. FieldItem labels each option.
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
Fieldset. | boolean | false | Disables the group and every control in it. |
Fieldset | ReactNode | unset | Names the group. The foundation associates the legend with the fieldset. |
Fieldset | ReactNode | unset | Describes the group. The Fieldset adds its id to aria-describedby. |
Fieldset. | ReactElement | render function | fieldset / div / p | Composed element. |
class | string | unset | Additional classes. Fieldset lays out its children in a grid with 12 px gaps, packed at the top, so a Fieldset that a row stretches to a taller neighbour keeps its rows together. The legend takes the strong weight, --sp-rw-font-weight-strong (600). |
Fieldset and FieldsetLegend wrap the Root and Legend parts of Base UI
Fieldset and add no props of
their own. Both accept refs and the other foundation props.
FieldsetDescription is a Siteplane UI part with native paragraph props, a ref
and render; its id is generated unless you set one. FieldsetPrimitive
exports the underlying Base UI Fieldset namespace for its parts and types.
Usage notes
Use a legend that explains what the group has in common. Fieldset does not submit, validate or save the form itself; compose it within Form.