VisorVisor
ComponentsForm

Fieldset

A semantic fieldset with styled legend for grouping related form fields.

Default

Contact Information

Disabled

Shipping Address

Installation

npx visor add fieldset

This copies two files into your project:

  • components/ui/fieldset/fieldset.tsx — the component
  • components/ui/fieldset/fieldset.module.css — the styles

Usage

import { Fieldset, FieldsetLegend } from '@/components/ui/fieldset/fieldset';

<Fieldset>
  <FieldsetLegend>Contact Information</FieldsetLegend>
  {/* form fields */}
</Fieldset>

API Reference

FieldsetProps

PropTypeDefaultDescription
disabledbooleanfalseDisables all form controls within the fieldset.
classNamestringAdditional CSS class names to merge onto the element.
...propsReact.FieldsetHTMLAttributes<HTMLFieldSetElement>All standard HTML fieldset attributes are forwarded.

Sub-components

ComponentElementPurpose
Fieldset<fieldset>Semantic grouping element for related form controls
FieldsetLegend<legend>Accessible caption for the fieldset, announced by screen readers

Accessibility

  • Renders a native <fieldset> element — semantically groups related controls
  • FieldsetLegend renders a <legend>, which screen readers associate with all controls inside the fieldset
  • Setting disabled on the <fieldset> propagates to all descendant form controls automatically via the browser
  • Prefer Fieldset + FieldsetLegend over generic <div> wrappers when controls share a logical purpose (e.g., address fields, contact info)