NimUI
ComponentsForms

Fieldset

Semantic form section with legend, description, and footer actions

The Fieldset component groups related form controls in a real <fieldset>/<legend> pair: assistive tech announces the group by its legend, and the native disabled prop switches off every control inside at once — ideal while a save mutation is in flight. The awkward default layout of <fieldset> (border-notch legend, intrinsic min-width) is normalized away.

Import

import {
  Fieldset,
  FieldsetLegend,
  FieldsetDescription,
  FieldsetContent,
  FieldsetFooter,
} from '@nim-ui/components';

Basic usage

Form Section
Shipping address

Used for carrier labels and customs forms.

Saved 2 minutes ago
Code
<Fieldset>
  <FieldsetLegend>Shipping address</FieldsetLegend>
  <FieldsetDescription>Used for carrier labels and customs forms.</FieldsetDescription>
  <FieldsetContent>
    <FormField label="Street" name="street">
      <Input />
    </FormField>
    <FormField label="City" name="city">
      <Input />
    </FormField>
  </FieldsetContent>
  <FieldsetFooter>
    <span>Saved 2 minutes ago</span>
    <Button size="sm">Save</Button>
  </FieldsetFooter>
</Fieldset>

Disabling a whole section

Native disabled reaches every descendant control — no per-field wiring.

Disabled Section
Billing profile

Locked while the invoice batch is processing.

Processing…
Code
<Fieldset disabled>
  <FieldsetLegend>Billing profile</FieldsetLegend>
  <FieldsetDescription>Locked while the invoice batch is processing.</FieldsetDescription>
  <FieldsetContent>{/* every control inside is disabled */}</FieldsetContent>
</Fieldset>

Props

Fieldset

NameTypeDefaultDescription
disabledbooleanfalseNative fieldset disabled — disables every descendant control
classNamestring-Additional CSS classes to apply
children*ReactNode-Legend, description, content, and footer parts

Parts

NameTypeDefaultDescription
FieldsetLegendlegend-Section title; names the group for assistive tech
FieldsetDescriptionp-Supporting text under the legend
FieldsetContentdiv-Field area with vertical spacing
FieldsetFooterdiv-Footer band — hint text left, actions right

Accessibility

  • Real <fieldset>/<legend> semantics: screen readers announce the legend when focus enters any control in the group.
  • disabled is the native attribute, so disabled state is conveyed to assistive tech without extra ARIA.
  • Keep one legend per fieldset, and make it a concise noun phrase ("Shipping address", not a sentence).

Best Practices

Do

  • Group fields that operators think of as one unit (address, billing profile, notification rules)
  • Use disabled during mutations instead of disabling fields one by one
  • Put save-state hints in the footer's left slot and the action on the right

Don't

  • Nest fieldsets — flatten into sibling sections instead
  • Use Fieldset as a generic card; Card is for non-form content
  • Hide the legend — the group needs a visible name
  • FormLayout - Page-level form arrangement
  • FormField - Label + control + error wiring
  • Card - Non-form content container

On this page