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

select

Dropdown menu for choosing from a list of predefined options. Vanilla Breeze resets the native appearance and adds a currentColor chevron, consistent sizing, and focus styling via design tokens.

When to Use

  • Choosing from a predefined list (countries, categories, sizes)
  • When the list has more than 5 options (otherwise consider radio buttons)
  • When screen space is limited
  • When the user cannot enter custom values

Consider alternatives:

  • Radio buttons for 2-5 options when space allows
  • datalist when users can type custom values alongside suggestions
  • combo-box for a fully custom filterable dropdown

Examples

Basic select, optgroup categorization, multiple selection, and disabled states.

Basic Select

With Option Groups

Organize options into categories using optgroup.

Multiple Selection

Allow selecting multiple options with the multiple attribute. Use size to control how many options are visible.

Required, with a Placeholder Option

A required single-row select is only invalid when the selected option is the placeholder label option: the first option, with an empty value="", and not inside an <optgroup>. Without that placeholder the browser selects the first real option and required never fails. The rule does not apply to multiple or size greater than 1: those are invalid only when nothing is selected.

The shared form layer styles select:user-invalid with the error border once the user has interacted, so an untouched form is not painted red on load.

Adding disabled to the placeholder (<option value="" disabled selected>) stops users from re-choosing it once they have picked a value. It is still the placeholder, so validation works the same way.

Disabled States

Disable the entire select or individual options within it.

Attributes

Attribute Purpose Example
name Form field name for submission name="country"
required Field must have a non-empty value. Needs a placeholder first option with value="" (see below); not applicable to multiple or size > 1 required
disabled Prevents selection disabled
multiple Allow selecting multiple options multiple
size Number of visible options (useful with multiple) size="5"
autocomplete Autofill hint autocomplete="country"

With form-field

Wrap a select in the form-field custom element for enhanced validation, required indicators, and helper text.

Accessibility

  • Always use a label: Every select needs an associated label, either wrapping or via for/id
  • Use autocomplete: Add appropriate autocomplete values for autofill (e.g., country)
  • Keyboard navigation: Arrow keys navigate options; typing jumps to matching text
  • Option groups: Help screen readers understand option categories
  • Avoid onChange submission: Do not submit forms automatically on select change without warning
  • Multiple select guidance: Provide visible instructions for Ctrl/Cmd-click

CSS Reference

VB sets appearance: none to remove the native dropdown arrow and draws its own chevron with a currentColor gradient in background-image, so the arrow always matches the text colour: it follows data-mode="dark", themes and forced-colors mode. It sits on the inline-end side and mirrors to the left under dir="rtl". Only single-row selects get it; multiple and size greater than 1 render as a list box with no arrow. The select inherits shared input styles (border, radius, focus ring) from the form layer.

Custom chevron

To swap the arrow, set --select-chevron to any image and --select-chevron-size to match. A url() image cannot see currentColor, so give it an explicit colour that works in both modes.

Customizable Select

Chrome 135+ ships appearance: base-select, which unlocks full CSS control over the dropdown picker, options, checkmark icon, and open/close animations — while retaining native semantics, keyboard navigation, form participation, and accessibility.

VB wraps all customizable-select styles in @supports (appearance: base-select), making this a zero-risk progressive enhancement. Non-supporting browsers keep the existing appearance: none + currentColor chevron.

What Changes Automatically

  • Dropdown picker gets surface background, border, radius, shadow, and max-height scroll
  • Options gain hover highlight, checked color, and rounded corners
  • Checkmark icon uses --color-interactive
  • Chevron rotates 180° on open
  • Picker animates in with opacity + translateY (respects prefers-reduced-motion)
  • <optgroup> headers render as uppercase muted section labels with dividers

No markup changes are required: every existing single-row <select> upgrades automatically. List boxes (multiple, or size greater than 1) are not upgraded and keep appearance: none.

Rich Content

For selects with images, icons, or descriptions inside options, add a <button> trigger with <selectedcontent> to mirror the selected option in the closed state.

  • <button> becomes the trigger. VB resets it to a plain content slot inside the select's own box: no padding, border, background, shadow, radius or minimum size. Theme button skins do not reach it, so a rich select is the same height as a plain one
  • Do not put aria-label on the inner button. The <label for> names the select, and browsers ignore names on the trigger
  • <selectedcontent> automatically clones the selected option's content
  • Elements with class="detail" are hidden in the closed trigger to keep it compact
  • Images inside options are sized to 1.5em with border-radius and object-fit: cover

Fallback Without base-select

Browsers without appearance: base-select parse a select with the older rules. The <button> and <selectedcontent> are dropped, and each option collapses to its plain text. The closed select shows the whole option text, including emoji and any .detail text, for example "🇺🇸 English — American English". aria-hidden on spans inside an option is lost with the spans.

  • Keep rich option text short and readable on its own, because it is also the fallback label
  • Put long descriptions in help text next to the select, not in the option, when they matter in every browser
  • Treat images and icons as decoration: the fallback has none of them

Styling Reference

The base-select value exposes these pseudo-elements and states:

Selector What It Targets
::picker(select) The dropdown popup container
::picker-icon The built-in chevron arrow
::checkmark The selected-option indicator
:open Select while picker is visible
selectedcontent Cloned content of selected option in trigger

Select vs Combo Box

Use this table to decide between the native customizable select and VB's combo-box web component.

Capability Customizable Select combo-box
JavaScript required No Yes
Filterable / searchable No (type-ahead only) Yes
Rich content in options Yes (images, icons, text) Yes
Form participation Native Manual (hidden input)
Browser support Chrome 135+ All modern browsers
Styled dropdown Yes (with @supports gate) Yes

Browser Support

appearance: base-select ships in Chrome 135 (April 2025). Other browsers are implementing it — check caniuse for current status.

VB's implementation is fully gated behind @supports:

Detect in JavaScript:

Related

  • option - Individual options within a select
  • optgroup - Group related options with a label
  • selectedcontent - Clone selected option content in the trigger button
  • datalist - Autocomplete with custom values
  • combo-box - Fully custom filterable dropdown
  • form-field - Enhanced select with validation
  • label - Required for accessibility
  • data-show-when - Show a section only when the select has a given value (multi-select aware)
  • data-autosave - Drafts keep single and multiple selections
  • multiple - More than one value, and how size interacts with it
  • required - Must-have-a-value fields, including the placeholder label option
↑