Skip to content
Fleetline

Select

Usage

Use a select to pick one option from a known list of about 5–15 items — depot, service type, vehicle class. Use radios for 2–5 options people should compare, and a combobox when the list is long or people know what they are looking for (a part number, one of 400 vehicles).

Anatomy

  1. Wrapper — .select, draws the chevron (::after, masked currentColor)
  2. Control — native select.select__control, same border, radius and heights as the text field
  3. Value or prompt option
  4. Picker — the OS list, or a token-styled ::picker(select) where customizable select is supported

Examples

Hover and focus-visible are frozen with .is-hover and .is-focus-visible, which share their rules with the real pseudo-classes.

Select

Vehicles can't change depot while a work order is open.

Set by the leasing contract.

Error: Select the depot where the vehicle parks overnight.

<div class="select [select--sm | select--lg]">
        <select class="select__control" id="depot" name="depot" required>
          <option value="">Choose a depot</option>
          <option>North Yard</option>
          <optgroup label="Preventive">…</optgroup>
        </select>
      </div>

      <!-- States -->
      <select class="select__control" … disabled>
      <select class="select__control" … aria-invalid="true" aria-describedby="depot-error">
      <!-- Read-only: <select> has no readonly; render only the current option -->
      <select class="select__control" … aria-readonly="true"><option selected>Airport Logistics Park</option></select>

API

HookValuesPurpose
.select + .select__controlblock / partWrapper with chevron + native select
.select--sm | --lgmodifier class32 / 40 (default) / 48px — same as inputs and buttons
disabled, requiredattributeNative states
aria-invalid="true", :user-invalidattribute / pseudo-classInvalid
aria-readonly="true" + one optionattributeRead-only (focusable, submitted, no chevron)
option[value=""]markupPrompt option, shown muted while selected
.is-hover | .is-focus-visibledocs-only classFreezes a state

Do and don't

Do use a native select with a prompt option for a short, known list.
Don't use a select for hundreds of options — use a combobox with search.

Accessibility

Keyboard interaction
KeyBehavior
TabFocuses the select
Space / Enter / Alt+↓Opens the picker
↑ ↓, typingMoves between options / jumps by first letters
EscCloses the picker without changing the value

Tokens

Custom propertyPurpose
--input-border, --input-bg, --input-radiusShared with text field
--size-control-sm | -md | -lgHeights
--color-text-mutedChevron, prompt option
--color-border-focus, --focus-ring-*, --color-border-invalidFocus, invalid
--color-bg-overlay, --overlay-radius, --overlay-shadow, --color-selected-*Customizable picker