Logobaseui-cn

Fieldset

A semantic wrapper for related form controls with a shared legend.

Newformlayoutsemantic
Loading preview...

Installation

npx baseui-cn add fieldset

Usage

import { Fieldset, FieldsetLegend } from "@/components/ui/fieldset"
<Fieldset className="space-y-4">
  <FieldsetLegend>Billing details</FieldsetLegend>
  {/* related fields */}
</Fieldset>

Examples

With helper content

Compose Fieldset with your existing Field primitives for grouped forms that stay semantic and readable.

Loading preview...

Disabled group

Fieldset supports native disabling. When disabled is set, all child controls become non-interactive while retaining clear structure.

Loading preview...

Multi-field section

Use Fieldset to group larger sets of related fields, such as an address or checkout form.

Loading preview...

API

Fieldset

Renders a native <fieldset> element via Base UI's Fieldset.Root.

PropTypeDefaultDescription
disabledbooleanfalseDisables all child form controls semantically via the native fieldset[disabled] attribute
classNamestringAdditional classes merged onto the root element
childrenReact.ReactNodeContent of the fieldset

FieldsetLegend

PropTypeDefaultDescription
variant"default" | "border""default""border" adds a bottom border rule below the legend
size"sm" | "md" | "lg""md"Controls font-size and vertical padding of the legend
classNamestringAdditional classes merged onto the legend element
childrenReact.ReactNodeLegend text or content

API Reference

See the Base UI Fieldset documentation for the full API reference, including all props, data attributes, and CSS classes.