Fieldset
A native fieldset element with an easily stylable legend.
View as MarkdownAnatomy
Import the component and assemble its parts:
import { Fieldset } from '@base-ui-components/react/fieldset';
<Fieldset.Root>
<Fieldset.Legend />
</Fieldset.Root>
API reference
Root
Groups the fieldset legend and the associated fields.
Renders a <fieldset>
element.
className
string | function
string | function
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
| string
| ((state: Fieldset.Root.State) => string)
render
ReactElement | function
ReactElement | 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
| ReactElement
| ((props: HTMLProps, state: Fieldset.Root.State) => ReactElement)
Legend
An accessible label that is automatically associated with the fieldset.
Renders a <div>
element.
className
string | function
string | function
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
| string
| ((state: Fieldset.Legend.State) => string)
render
ReactElement | function
ReactElement | 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
| ReactElement
| ((props: HTMLProps, state: Fieldset.Legend.State) => ReactElement)