Vanilla Breeze v0.7.4

Vanilla Breeze v0.7.4 released

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…

Read the release notes

selectedcontent

Displays a clone of the currently selected option's content inside a customizable select's button trigger. Used with appearance: base-select to show rich content (icons, images, descriptions) in the closed select state.

When to Use

  • Inside a customizable select to show a custom trigger with rich content
  • When options contain images, icons, or descriptions that should be mirrored in the closed state
  • When you need CSS control over how the selected value displays in the button

Requirements: Only works when the browser supports appearance: base-select (Chrome 135+). In non-supporting browsers, the select falls back to its standard rendering.

How It Works

The browser automatically clones the currently selected <option>'s DOM into the <selectedcontent> element using cloneNode(). It updates whenever the selected option changes, whether the user picks one or a script sets select.value, select.selectedIndex or option.selected. No change event is needed.

Required Structure

The nesting must follow this exact pattern:

  • <button> must be the first child of <select>
  • <selectedcontent> must be inside that <button>
  • All <option> elements come after the button
  • Both opening and closing tags are mandatory

Examples

Basic

A plain select with a custom trigger. The selected option text is cloned into the button automatically.

Rich Content with Flags

Options with emoji flags and descriptions. The .detail text is hidden in the closed trigger via CSS to keep it compact.

Styling

Since <selectedcontent> contains a clone of the selected option's DOM, you can target child elements to control what is visible in the closed state versus the open dropdown.

VB applies these styles automatically inside @supports (appearance: base-select):

  • selectedcontent gets display: flex with align-items: center and gap
  • selectedcontent .detail is hidden by default
  • The parent button fills the select width as a flex container, and is reset to a plain content slot (no padding, border, background, shadow or minimum size, even under themes)

Attributes

<selectedcontent> accepts only global HTML attributes (class, id, style, data-*, etc.). There are no element-specific attributes.

Accessibility

  • Inert by default: The <button> inside <select> is inert, so <selectedcontent> and its children cannot be focused or interacted with independently
  • Name and value: Screen readers announce the select by its <label> and the selected option's text as its value. The clone in the trigger is not announced separately
  • Cloned content: Decorative elements (icons, flags) in options should use aria-hidden="true" since they are cloned into the trigger as well
  • Keyboard navigation: Fully handled by the parent <select> — no additional keyboard handling needed

Caveats

  • Update triggers: The clone refreshes when the selected option changes, by user or by script (select.value = …, option.selected = true). Editing the content of the option that is already selected may not refresh the clone; re-select it (for example, set select.value again) after changing its content
  • Fallback: Browsers without base-select drop the <button> and <selectedcontent> and show each option's plain text, so keep option text short. See select, "Fallback Without base-select"
  • Implicit button: If you omit <button> and <selectedcontent>, the browser creates an implicit button that cannot be targeted with CSS type selectors
  • Experimental: This element is not yet Baseline — check browser support before relying on it in production

Browser Support

Requires appearance: base-select support (Chrome 135+). VB gates all related styles behind @supports, so non-supporting browsers get the standard select rendering with each option's plain text in the closed select.

Related

  • select — Parent element; see the Customizable Select section for the full base-select guide
  • option — Options whose content gets cloned into selectedcontent
  • optgroup — Group related options with styled section headers
  • button — The required parent of selectedcontent inside a customizable select
  • combo-box — Alternative for filterable dropdowns with full browser support
↑