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/react/fieldset';
<Fieldset.Root>
<Fieldset.Legend />
</Fieldset.Root>API reference
Root
Groups the fieldset legend and the associated fields.
Renders a <fieldset> element.
classNamestring | 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 | undefined) | undefined
styleReact.CSSProperties | function—
React.CSSProperties | function- Name
- Type
| React.CSSProperties | (( state: Fieldset.Root.State, ) => React.CSSProperties | undefined) | undefined
renderReactElement | 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
ReactElementor a function that returns the element to render.- Type
| ReactElement | (( props: HTMLProps, state: Fieldset.Root.State, ) => ReactElement) | undefined
Additional Types
Fieldset.Root.Props
Re-Export of Root props as FieldsetRootProps
Fieldset.Root.State
type FieldsetRootState = { disabled: boolean };Legend
An accessible label that is automatically associated with the fieldset.
Renders a <div> element.
classNamestring | 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 | undefined) | undefined
styleReact.CSSProperties | function—
React.CSSProperties | function- Name
- Type
| React.CSSProperties | (( state: Fieldset.Legend.State, ) => React.CSSProperties | undefined) | undefined
renderReactElement | 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
ReactElementor a function that returns the element to render.- Type
| ReactElement | (( props: HTMLProps, state: Fieldset.Legend.State, ) => ReactElement) | undefined
Additional Types
Fieldset.Legend.Props
Re-Export of Legend props as FieldsetLegendProps
Fieldset.Legend.State
type FieldsetLegendState = { disabled: boolean };