Fieldset
Groups related controls under a shared legend.
Installation
Install the following dependencies:
Set up the token layer and the StyleX compiler from Installation, including state-styles.ts.
Install Stack for fieldset layout.
Copy and paste the following code into your project.
Update the import paths to match your project setup.
Usage
Anatomy
Fieldset contains a FieldsetLegend followed by related Field controls.
API reference
Accepts Base UI Fieldset props, including render, plus xstyle, className and inline style.
Fieldset
| Prop | Type | Default |
|---|---|---|
gap | SpacingStep | 4 |
FieldsetLegend
| Prop | Type | Default |
|---|---|---|
variant | "legend" | "label" | "legend" |
fieldsetStyles
| Key | What it is |
|---|---|
root | Shrinkable fieldset |
legend | Legend weight and bottom space |
variants | Legend and label type sizes |
Data attributes
| Attribute | On | Effect |
|---|---|---|
data-slot="fieldset" | root | Fieldset anatomy |
data-slot="fieldset-legend" | legend | Legend anatomy |
data-variant | legend | Type size |
data-disabled | root and legend | Base UI disabled state |