Brutalist Fieldset
Group related form fields with accessible naming, description text, and cascading disabled state.
Brutalist Fieldset groups related form fields with a semantic legend, optional description, and cascading disabled state in a clean unboxed vertical stack.
Preview
Section titled “Preview”<proto-ui-brutalist-fieldset-root>
<proto-ui-brutalist-fieldset-legend>
Address Information
</proto-ui-brutalist-fieldset-legend>
<proto-ui-brutalist-fieldset-description>
We need your address to deliver your order.
</proto-ui-brutalist-fieldset-description>
<div class="grid gap-4">
<proto-ui-brutalist-field-root>
<proto-ui-brutalist-field-label>
Street Address
</proto-ui-brutalist-field-label>
<proto-ui-brutalist-field-control></proto-ui-brutalist-field-control>
<proto-ui-brutalist-field-error></proto-ui-brutalist-field-error>
</proto-ui-brutalist-field-root>
<div class="grid grid-cols-2 gap-4">
<proto-ui-brutalist-field-root>
<proto-ui-brutalist-field-label>
City
</proto-ui-brutalist-field-label>
<proto-ui-brutalist-field-control></proto-ui-brutalist-field-control>
</proto-ui-brutalist-field-root>
<proto-ui-brutalist-field-root>
<proto-ui-brutalist-field-label>
Postal Code
</proto-ui-brutalist-field-label>
<proto-ui-brutalist-field-control></proto-ui-brutalist-field-control>
</proto-ui-brutalist-field-root>
</div>
</div>
</proto-ui-brutalist-fieldset-root>Installation
Section titled “Installation”Available starting in 0.3.0-rc.1 and later releases.
import { FieldsetRoot, FieldsetLegend, FieldsetDescription } from '@/components/brutalist/fieldset';import { FieldRoot, FieldLabel, FieldControl } from '@/components/brutalist/field';
export function Example() { return ( <FieldsetRoot> <FieldsetLegend>Address Information</FieldsetLegend> <FieldsetDescription>We need your address to deliver your order.</FieldsetDescription> <FieldRoot required> <FieldLabel>Street Address</FieldLabel> <FieldControl placeholder="123 Main St" /> </FieldRoot> </FieldsetRoot> );}- Root: Establishes the
grouprole and computes the effective disabled state from its owndisabledprop and any enclosingFieldset, arranged as an unboxedgap-4vertical stack usingfont-sans font-medium. - Legend: Optional heading using
font-heading font-boldper the Brutalist design contract, preserving authored casing, supportingvariant="legend"(default) andvariant="label", and adding no tab stop. - Description: Optional wrappable help copy rendered in crisp foreground text with disabled state feedback.
Each group accepts at most one Legend and one Description. ARIA labelling and description attributes are automatically linked and cleaned up on unmount without manual DOM IDs, and nested groups never leak targets across scopes.
Nested disabled behavior
Section titled “Nested disabled behavior”Effective disabled state cascades through nested Fieldset roots without clearing local disabled flags when an ancestor is re-enabled:
- Disabling
outerdisablesouter,middle, andinner. - Disabling
middleand then re-enablingouterkeepsmiddleandinnerdisabled. - Re-enabling
middlere-enablesinnerunlessinnerhasdisabled={true}.
Every participating Field inside the group—including fields placed inside Legend—inherits the group’s disabled state.
Examples
Section titled “Examples”Label-scale legend and checkbox group
Section titled “Label-scale legend and checkbox group”<proto-ui-brutalist-fieldset-root>
<proto-ui-brutalist-fieldset-legend id="desktop-legend">
Desktop items
</proto-ui-brutalist-fieldset-legend>
<proto-ui-brutalist-fieldset-description>
Select the items you want to show on the desktop.
</proto-ui-brutalist-fieldset-description>
<proto-ui-brutalist-checkbox-group-root id="desktop-group">
<proto-ui-brutalist-checkbox-group-all>
Select all
</proto-ui-brutalist-checkbox-group-all>
<proto-ui-brutalist-checkbox-group-item>
Hard disks
</proto-ui-brutalist-checkbox-group-item>
<proto-ui-brutalist-checkbox-group-item>
External disks
</proto-ui-brutalist-checkbox-group-item>
<proto-ui-brutalist-checkbox-group-item>
Connected servers
</proto-ui-brutalist-checkbox-group-item>
</proto-ui-brutalist-checkbox-group-root>
</proto-ui-brutalist-fieldset-root>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
setElementProps(document.querySelector('#desktop-legend'), {
variant: 'label',
});
setElementProps(document.querySelector('#desktop-group'), {
defaultValue: ['hard-disks', 'connected-servers'],
ariaLabel: 'Desktop items',
});
</script>Nested disabled inheritance
Section titled “Nested disabled inheritance”<div class="grid gap-4">
<div class="flex gap-2">
<proto-ui-brutalist-button id="toggle-outer">
Toggle outer disabled
</proto-ui-brutalist-button>
<proto-ui-brutalist-button id="toggle-middle">
Toggle middle disabled
</proto-ui-brutalist-button>
</div>
<proto-ui-brutalist-fieldset-root id="outer-group">
<proto-ui-brutalist-fieldset-legend>
Workspace Policy (Outer)
</proto-ui-brutalist-fieldset-legend>
<proto-ui-brutalist-fieldset-description>
Disabling an outer group cascades into every nested group and
field.
</proto-ui-brutalist-fieldset-description>
<proto-ui-brutalist-fieldset-root id="middle-group">
<proto-ui-brutalist-fieldset-legend>
Billing Department (Middle)
</proto-ui-brutalist-fieldset-legend>
<proto-ui-brutalist-fieldset-root id="inner-group">
<proto-ui-brutalist-fieldset-legend>
Invoice Overrides (Inner)
</proto-ui-brutalist-fieldset-legend>
<proto-ui-brutalist-field-root>
<proto-ui-brutalist-field-label>
Purchase order
</proto-ui-brutalist-field-label>
<proto-ui-brutalist-field-control></proto-ui-brutalist-field-control>
</proto-ui-brutalist-field-root>
</proto-ui-brutalist-fieldset-root>
</proto-ui-brutalist-fieldset-root>
</proto-ui-brutalist-fieldset-root>
</div>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
let outer = false;
let middle = false;
document
.querySelector('#toggle-outer')
?.addEventListener('click', () => {
outer = !outer;
setElementProps(document.querySelector('#outer-group'), {
disabled: outer,
});
});
document
.querySelector('#toggle-middle')
?.addEventListener('click', () => {
middle = !middle;
setElementProps(document.querySelector('#middle-group'), {
disabled: middle,
});
});
</script>| Prop | Type | Default |
|---|---|---|
disabled | boolean | false |
ariaLabel | string | '' |
Legend
Section titled “Legend”| Prop | Type | Default |
|---|---|---|
variant | 'legend' 'label' | 'legend' |
Description
Section titled “Description”Description declares no props of its own; all three parts expose read-only effective disabled state (ExposeState<boolean>).