Skip to main content

A group of related fields with a legend, helper text and error text, that disables everything inside it at once.

Shipping address
We only use it to send your order.
<primitives:fieldset.root>
    <primitives:fieldset.legend />
    <primitives:fieldset.helperText />
    <!-- fields, checkboxes, ... -->
    <primitives:fieldset.errorText />
</primitives:fieldset.root>
typo3 ui:add fieldset

Read more about installing Components and Primitives.

Set disabled on the root. The fieldset carries it to everything inside, whatever the props of the fields say, and the browser skips them when the form is submitted.

Account
Everything inside is disabled, whatever its own props say.

invalid marks the group as a whole, e.g. "choose at least one". It is not passed on to the fields inside, they keep validating themselves.

Notifications
Choose how we reach you.
Choose at least one way to reach you.

Fields watch the disabled attribute of the fieldset they are in, so changing it afterwards reaches them too. Mount the fieldset yourself (autoMount="{false}") to get hold of the instance, and update its props:

Profile

The following tables cover the available props of the Fluid Primitives. For a full list of available client side props and methods, see the Zag.js Machine API.

Provides the fieldset state and wraps the group. Renders a <fieldset> element.

NameDescriptionRequiredDefault
disabledboolean
Whether the fieldset is disabled. Native `<fieldset disabled>` semantics carry the disabled state to every control inside, and to every `Field` inside it.
No
-
invalidboolean
Whether the fieldset is invalid. Not inherited by the fields inside it.
No
-
attributesarray
Additional attributes that should be rendered on the component where ui:attributes is used.
No
[]
asChildboolean
If true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props.
No
-
rootIdstring
The root ID of the component, used for hydration and identification.
No
-
idsarray
The IDs of of the component parts for composition.
No
[]
autoMountboolean
Whether the client initializes the component on its own. Set it to false to mount it yourself with `mount()`
No
true
classstring
The CSS class(es) to be applied to the component.
No
-

Rendered data attributes

AttributeDescription
data-fieldset-root<uid>
data-disabledPresent when disabled
data-invalidPresent when invalid

Names the group. Renders a <legend> element, which needs to be the first child of the root.

NameDescriptionRequiredDefault
attributesarray
Additional attributes that should be rendered on the component where ui:attributes is used.
No
[]
asChildboolean
If true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props.
No
-
classstring
The CSS class(es) to be applied to the component.
No
-

Rendered data attributes

AttributeDescription
data-fieldset-legend<uid>
data-disabledPresent when disabled
data-invalidPresent when invalid

Explains the group. Renders a <div> element.

NameDescriptionRequiredDefault
attributesarray
Additional attributes that should be rendered on the component where ui:attributes is used.
No
[]
asChildboolean
If true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props.
No
-
classstring
The CSS class(es) to be applied to the component.
No
-

Rendered data attributes

AttributeDescription
data-fieldset-helper-text<uid>
data-disabledPresent when disabled
data-invalidPresent when invalid

Tells what is wrong with the group, hidden unless the fieldset is invalid. Renders a <div> element.

NameDescriptionRequiredDefault
attributesarray
Additional attributes that should be rendered on the component where ui:attributes is used.
No
[]
asChildboolean
If true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props.
No
-
classstring
The CSS class(es) to be applied to the component.
No
-

Rendered data attributes

AttributeDescription
data-fieldset-error-text<uid>
data-disabledPresent when disabled
data-invalidPresent when invalid
NameTypeDescription
idsResolvedElementIdsThe resolved element ids, for composition with other components.
disabledbooleanWhether the fieldset is disabled (including inherited ancestor fieldset state).
invalidbooleanWhether the fieldset is invalid.
getRootState() => RootStateReturns the state of the root.
getLegendState() => LegendStateReturns the state of the legend.
getHelperTextState() => HelperTextStateReturns the state of the helper text.
getErrorTextState() => ErrorTextStateReturns the state of the error text.