Skip to content

Fieldset

Native <fieldset> + <legend> wrapper for grouping related form controls; disabling the fieldset cascades to every nested control.

  • stable
  • since v0.1.0
  • 0.47 kB
  • forms

Renders a real <fieldset> with an optional <legend> so the grouping and its name are exposed natively to assistive tech.

Preview
Open
tsx

The legend prop accepts any node — text, an inline icon, or a heading.

Preview
Open
tsx

Setting disabled on the fieldset natively disables every nested form control — no per-field wiring required.

Preview
Open
tsx

Combine with CheckboxGroup or RadioGroup to give a cluster of inputs a visible name plus a focus boundary.

Preview
Open
tsx
PropTypeDefaultDescription
legend
ReactNode
Optional legend. Rendered as the first child inside the fieldset.
className
string
  • Renders a real <fieldset> and <legend> — screen readers automatically announce the legend when focus enters any nested control.
  • disabled is forwarded to the native fieldset, which disables every descendant form element without extra ARIA work.
  • A data-disabled attribute mirrors the disabled flag for CSS hooks that need to dim sibling content.
  • Keep the legend visible — hiding it removes the group’s accessible name.
  • Use one Fieldset per logical section (“Account”, “Address”, “Preferences”) instead of one large form.
  • Pair with CheckboxGroup / RadioGroup to combine semantic grouping with a controlled value.
  • Avoid nesting fieldsets more than one level deep — long announcement chains become noisy.