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…
Making it easier to scan and locate options in a large list
Examples
Grouped options in a dropdown, a disabled group, and groups in a listbox (size greater than 1).
Basic Usage
The required labelattribute provides the group heading shown above the options.
Basic optgroup usage
<selectid="category"><optionvalue="">Select a category...</option><optgrouplabel="Fruits"><optionvalue="apple">Apple</option><optionvalue="banana">Banana</option><optionvalue="orange">Orange</option></optgroup><optgrouplabel="Vegetables"><optionvalue="carrot">Carrot</option><optionvalue="broccoli">Broccoli</option><optionvalue="spinach">Spinach</option></optgroup></select>
In a classic select the open list is drawn by the browser or the operating system. VB sets font-weight: 600 on optgroup (the browser resets the weight of the options inside it); colours, backgrounds and icons are out of reach.
Where customizable select is supported (appearance: base-select, Chromium 135+), VB styles a single-row select's group headings as small, muted, uppercase labels with a divider above every group after the first. The heading looks the same whether it comes from the labelattribute or from a <legend> first child. Listbox selects (multiple, or size greater than 1) keep the browser rendering.
Keep the labelattribute when you add a <legend>: browsers without customizable select drop the legend, so label is the heading they show and the name assistive technology reads.
Limitations
No nesting: You cannot nest an optgroup inside another optgroup. HTML does not support it
Content: An optgroup holds option elements, plus an optional leading <legend> in a customizable select
Label is required: The labelattribute must be provided; there is no fallback text
Not in datalist: Optgroups are not supported inside datalist
For fully custom grouped dropdowns with arbitrary styling, consider the combo-boxweb component.
Accessibility
Screen reader support: Browsers expose an optgroup as a group named by its label, and some screen readers announce that name when focus moves into a new group. Not every screen reader and pop-up does, so keep each option understandable on its own
Keyboard navigation: Arrow keys move through all options across groups; the group headings cannot be focused or selected
Meaningful labels: The labelattribute should clearly describe what the group contains
Disabled groups: Every option in a disabled group is disabled and announced as unavailable. VB shows disabled options and group headings in GrayText in forced-colors mode