Fieldset

A native fieldset element with an easily stylable legend.

Base UI React 1.8.0
Billing details
FineSoft Stencil
Billing details

The Stencil comparison uses fs-fieldset-root and fs-fieldset-legend with fs-field-root, fs-field-label, and fs-field-control for its controls. Field supplies their label registration, validation, and field-state attributes. The migrated Form adds inherited validation mode, consolidated values, form-level errors, and submit validation.

The Base UI theme is built in; set data-fs-theme="base-ui" on an ancestor to style the Stencil parts without component classes. Legend exposes its native label through fs-fieldset-legend::part(legend) for custom styling. Root keeps its native fieldset in Light DOM so descendant controls retain native disabled inheritance and form ownership.

Anatomy

Import the component and assemble its parts:

Anatomy

API reference

Root

Groups a shared legend with related controls. Renders a <fieldset> element.

classNamestring | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
styleReact.CSSProperties | function
Name
Description

Style applied to the element, or a function that returns a style object based on the component’s state.

Type
renderReactElement | function
Name
Description

Allows you to replace the component’s HTML element with a different tag, or compose it with another component.

Accepts a ReactElement or a function that returns the element to render.

Type

Fieldset.Root.PropsHide

Re-Export of Root props as FieldsetRootProps

Fieldset.Root.StateHide

Legend

An accessible label that is automatically associated with the fieldset. Renders a <div> element.

classNamestring | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
styleReact.CSSProperties | function
Name
Description

Style applied to the element, or a function that returns a style object based on the component’s state.

Type
renderReactElement | function
Name
Description

Allows you to replace the component’s HTML element with a different tag, or compose it with another component.

Accepts a ReactElement or a function that returns the element to render.

Type

Fieldset.Legend.PropsHide

Re-Export of Legend props as FieldsetLegendProps

Fieldset.Legend.StateHide