0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…
Providing context for radio button or checkbox groups
Sectioning complex forms into logical parts
Important: The legend must be the first child of a fieldset for proper rendering.
VB Styling
Vanilla Breeze sets font-weight: 600, font-size: var(--font-size-s) and padding-inline: var(--size-s) on legend. In a bordered fieldset, the legend visually breaks the top border. In a fieldset[data-variant="minimal"], the legend loses its inline padding and gains a bottom margin, acting as a section heading at font-size: var(--font-size-m).
Basic Usage
A legend provides the accessible name for its fieldset group.
Basic legend usage
1234
<fieldset><legend>Personal Information</legend><!-- form fields --></fieldset>
Visual Styles
Default (Bordered Fieldset)
In a standard fieldset with a visible border, the legend appears inset in the top border.
Minimal Fieldset
In a fieldset[data-variant="minimal"], the border is removed and the legend appears as a section heading with increased font size and a bottom margin.
Minimal fieldset legend
123456789
<fieldsetdata-variant="minimal"><legend>Preferences</legend><label><inputtype="checkbox"name="prefs"value="dark" /> Dark mode</label><label><inputtype="checkbox"name="prefs"value="reduce" /> Reduce motion</label></fieldset>
For Radio Groups
Radio buttons should always be in a fieldset with a legend. Screen readers announce the legend before each option.
Screen Reader Behavior
When navigating radio buttons, screen readers announce:
"Select Payment Method, radio group"
"Credit Card, radio button, 1 of 3, checked"
"PayPal, radio button, 2 of 3"
Rich Content in Legends
Legends can contain simple inline content but should remain concise.
Rich content in legend
1234
<fieldset><legend><strong>Required:</strong> Contact Details</legend><!-- form fields --></fieldset>
Nested Fieldsets
When nesting fieldsets, each needs its own legend for proper hierarchy. A common pattern is a bordered outer fieldset with minimal inner fieldsets.
Nested fieldsets
12345678910111213
<fieldset><legend>Shipping Information</legend><fieldsetdata-variant="minimal"><legend>Address</legend><!-- address fields --></fieldset><fieldsetdata-variant="minimal"><legend>Delivery Options</legend><!-- radio buttons --></fieldset></fieldset>
States
Required group
Inside <form-field>, a fieldset with a required control gets an asterisk after its legend automatically (form-field > fieldset > legend::after). The asterisk is silent to screen readers, because each control announces its own required state. Do not type a * into the legend as well, or it shows twice.
In fieldset:disabled the legend turns muted (--color-text-muted, GrayText in forced-colors mode) along with the controls. The border becomes dashed unless the fieldset is minimal.
Status
fieldset[data-status="success|warning|error"] tints the border only. Colour alone carries no meaning, so put the status in words too, in the legend (“Payment — needs attention”) or in a message inside the group. See fieldset.
Accessibility Notes
Must be first child: The legend must be the first element inside a fieldset
Keep concise: Legends should be brief but descriptive
Announced as group label: Screen readers use the legend to introduce the fieldset
Required for radio groups: Always use fieldset/legend for radio button groups
Prefer a visible legend: legend.visually-hidden is acceptable when the surrounding context already names the group visibly, as with a segmented control under a visible heading
CSS Reference
Legend CSS styles
123456789101112
legend {padding-inline: var(--size-s);font-weight: 600;font-size: var(--font-size-s);}/* In a minimal fieldset, legend acts as a section heading */fieldset[data-variant="minimal"] > legend {padding: 0;margin-block-end: var(--size-s);font-size: var(--font-size-m);}