Fieldset
vig-fieldset
import { Fieldset } from '@vigdx/ui/fieldset';Basic
legend names the group; project the fields.
Checkbox group, disabled and collapsible
disabled disables the native fieldset and with it every control inside. collapsible puts a disclosure button in the legend; [(collapsed)] holds the state.
Radio buttons and checkboxes
vig-radio-group already renders a fieldset with its label as the legend, plus the group's required and invalid states: do not wrap a single radio group in a vig-fieldset just to name it. Use vig-fieldset for checkbox lists and for groups that mix several fields.
disabled is the native fieldset attribute: the browser disables the native controls inside and leaves them out of form submission, and the kit's controls follow it too (their own widgets such as rating and knob sliders, and their disabled look), also through nested fieldsets. The forms model is not changed: to disable fields in Signal Forms or Reactive Forms, disable them there.
The group's name is the legend input rather than the kit's usual heading: it renders the native <legend>, which names the group but is not a heading.
Styling hooks
Internal elements carry a stable data-part and the component's data-scope; both are public API, so removing one is a breaking change. Select a part by both, e.g. [data-scope="fieldset"][data-part="group"] { … }: the pair stays within this component when kit components nest, and also reaches parts in overlay panels, which render outside the host. State is exposed through aria-* and, where listed, a data-state; literal values are checked by the API gate, values computed from the component's state follow its documented types. Other data-* attributes listed below (such as data-opening while an overlay animates) are API too. See Customizing.
Scope: [data-scope="fieldset"]
| Part | Element | data-state |
|---|---|---|
group | <fieldset> . | open, closed |
legend | <legend> . | — |
trigger | collapsible fieldset. | open, closed |
indicator | — | |
content | hidden="until-found" while collapsed); data-state only when collapsible. | open, closed |
body | — |
Accessibility
- Native semantics: the
<legend>names the group, and screen readers announce it when focus enters the group. - The collapse button sits inside the legend, so the legend keeps naming the group; it stays usable while the fieldset is disabled. Collapsed fields stay in the DOM as
hidden="until-found": they keep their values and are submitted, and find-in-page reveals them.
API
Fieldset
vig-fieldsetA native <fieldset> with its <legend>: groups related fields under one
name that screen readers announce on entering the group (an address, a
set of checkboxes). disabled disables the native fieldset, which
disables every native control inside it, the kit's fields included.
<vig-fieldset legend="Shipping address">
<vig-input label="Street" … />
<vig-input label="City" … />
</vig-fieldset>collapsible puts a disclosure button (aria-expanded, aria-controls)
in the legend, which keeps naming the group; the fields of a collapsed
fieldset stay in the DOM as hidden="until-found" (still submitted, and
find-in-page expands it). The legend's button stays usable while the
fieldset is disabled, as the HTML spec has it.
| Name | Type | Default | Description |
|---|---|---|---|
collapsed | boolean | false | Whether the fields are collapsed; two-way bindable. Ignored unless |
collapsible | boolean | false | Puts a button in the legend that collapses and expands the fields. |
disabled | boolean | false | Disables the native fieldset and with it every native control inside. |
legend | string | — | The group's name, rendered in the |
| Name | Payload | Description |
|---|---|---|
collapsedChange | boolean | Whether the fields are collapsed; two-way bindable. Ignored unless |
| Signature | Description |
|---|---|
toggle(): void | Collapses expanded fields or expands collapsed ones. |