Fieldset
Semantic fieldset with a styled legend, sharing FormGroup's validation context. Use when the grouping is meaningful to assistive tech.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
legend | ReactNode | — | Fieldset legend text. |
description | ReactNode | — | Dim explanatory line under the legend. |
action | ReactNode | — | Right-aligned control in the legend row (a Switch that enables the section, typically). |
children | ReactNode | — | Form content inside the fieldset. |
tone | ValidationTone | — | Validation tone: "error" | "warning" | "success". |
message | ReactNode | — | Validation summary rendered under the group. |
required | boolean | — | Appends a red asterisk to the legend. |
bordered | boolean | true | Draws the bordered box. Off gives a plain labeled block. |
Fieldset extends FieldsetHTMLAttributes<HTMLFieldSetElement>.
Usage
Bordered
Unbordered
With action toggle
With validation
import { Fieldset } from "@solarius/onset";
import type { FieldsetProps } from "@solarius/onset";
<Fieldset legend="Billing address" description="Used for invoices.">
<Field label="Street"><Input placeholder="123 Main St" /></Field>
</Fieldset>
<Fieldset legend="Notifications" action={<Switch checked />}>
<Field label="Email"><Input /></Field>
</Fieldset>