Forms
Fieldset
A <fieldset> that groups related fields under a title, such as the address or the billing section of a form. The title is a <legend>, so screen readers announce it when focus enters any field inside.
Nothing to show
"Address" as a heading, "Where we ship your order" in muted text under it, then the two fields with even spacing. The fieldset is described by the description, so it is read together with the title.
Disabling a whole section #
While $sameAsBilling is true every control inside is disabled by the browser, and the title and labels are dimmed. Disabled controls are not sent with the form.
Nothing to show
A title with more than text #
The title takes the element props through the label: prefix: here an icon before it and an "Optional" badge after it. badge and info also reach the title without the prefix.
Nothing to show
Sizes #
size sets the size of the title and the description, from xs to 3xl.
Nothing to show
Own legend #
Without label and description no legend is rendered; place a tk:legend in the slot for a title of your own.
Nothing to show
Customization #
Classes go to the <fieldset>; label: and description: attributes reach the title and the description.
Nothing to show
Reference
tk:fieldset
| Prop | Type | Default | Description |
|---|---|---|---|
label |
string | slot | null |
The title, rendered as a <legend> and translated. |
description |
string | slot | null |
Text under the title, linked to the fieldset with aria-describedby. |
size |
string | md |
xs, sm, md, lg, xl, 2xl or 3xl. Sets the size of the title and the description. |
id |
string | generated | The fieldset id, also the base of the description id (<id>-description). |
disabled is the native attribute and disables every control inside.
Slots
| Slot | Description |
|---|---|
| default | The fields. |
Prefixes
| Prefix | Goes to |
|---|---|
label: |
The <legend>, including its element props (label:icon, label:badge...). |
description: |
The description. |
Customization
Classes and attributes on the tag go to the <fieldset>. To reach the parts, prefix the attribute (listed in the Reference above).
Nothing to show
Accessibility
A native <fieldset> with a <legend>, which gives the group its name. The description is added to the fieldset's aria-describedby, after any id passed in that attribute.
Behavior notes
- Without
labelanddescriptionno<legend>is rendered; atk:legendcan be placed in the slot instead. - Every field inside gets a bottom margin, nested ones included; fields placed directly inside also get extra space after a help text, and the last one none.