Fieldset

A native fieldset element with an easily stylable legend.

View as Markdown
Billing details

Anatomy

Import the component and assemble its parts:

Anatomy

API reference

Root

Groups the fieldset legend and the associated fields. Renders a <fieldset> element.

className

string | function

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

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

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

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)