Fieldset
Fieldset groups related form fields under a shared semantic legend.
Purpose
Fieldset groups related form fields under one shared semantic legend. A standalone field does not need a Fieldset.
Grouped fields
Installation
With the Siteplane registry alias configured, add the component and import the installed source from your app.
CLI
pnpm dlx shadcn@4.16.1 add @siteplane/fieldsetImport
import { Fieldset, FieldsetLegend } from "@/components/ui/fieldset";Need the machine-readable source metadata? View registry JSON.
Usage
Use Fieldset to group related fields under one legend when several fields form one decision or setting.
import { Fieldset, FieldsetLegend } from "@/components/ui/fieldset";
import { Field, FieldLabel } from "@/components/ui/field";
import { Input } from "@/components/ui/input";
export function Example() {
return (
<Fieldset>
<FieldsetLegend>Profile</FieldsetLegend>
<Field><FieldLabel>Name</FieldLabel><Input /></Field>
</Fieldset>
);
}Examples
Disabled state, layout groupings, choice sets and form integration are compositions of the same primitive.
Disabled
The native disabled attribute deactivates and dims every child control.
Two column
Nested fieldsets
Legend with description
Choice set
Settings section
Fieldset in form
API Reference
The reference lists the source-owned exports and props that are easy to miss in visual examples. Inherited Base UI props remain available unless the wrapper narrows them.
Fieldsetrenders a native fieldset andFieldsetLegendprovides its group name.- Put
FieldsetLegendfirst, then compose each control withField. disableddisables all descendant form controls.- The default layout is a grid with system spacing; use existing spacing classes only when the composition needs a different density.
Motion
Component motion uses the shared Siteplane motion contract. See the global motion guide for provider setup, tokens and reduced-motion behavior.
- Fieldset has no animation.
- Descendant controls retain their own focus, disabled, and reduced-motion behavior.
- Disabled and nested Fieldsets must not change control dimensions.
Accessibility
- Every Fieldset requires a
FieldsetLegendthat names the group. - Connect optional group descriptions with
aria-describedby. - Keep each descendant control connected to its own FieldLabel and FieldError.
- Do not use Fieldset only for visual layout when the fields are not semantically related.
Implementation Guidance
- Group related controls with exactly one legend.
- Do not place fields in a Fieldset without
FieldsetLegend. - Preserve native fieldset and disabled semantics.