Select

Picks one option from a closed list, for choices too many for radios.

Refined portVue source: WildSelect.vueStorybook story: Forms/SelectReact component: WSelect

Try it

Open it, arrow through it and choose. The decommissioned bore can’t be picked.

Size
Error
Disabled
<WildSelect
  v-model="site"
  :options="sites"
  placeholder="Choose a site"
  size="sm"
/>

When to use

  • Use a select to choose one option from a list too long to show at once.
  • Keep an option that can’t be chosen in the list and disable it, so the list doesn’t change shape.
Don’t use it
  • For a few options people should compare side by side. Use a Radio group.
  • For a list long enough to need searching. Use Search select.

Anatomy

A trigger that shows the choice and a chevron, and a list that opens beneath it.

Choose a site
placeholder
Bore 12 — north paddock
chosen
Bore 12 — north paddock
open
<WildSelect v-model="site" placeholder="Choose a site" />
<WildSelect v-model="site" :options="sites" size="lg" />
The placeholder is a prompt, never a label. Give the select a label with Form field.

States

rest
Bore 12
hover
Bore 12
focus
Bore 12
error
Bore 12
disabled
Bore 12
Focus and open share a 2px blue-1000 border and chevron. Open also flips the chevron.

Sizes

Two, matching the input: 36 and 44px.

Bore 12
sm · 36
Bore 12
lg · 44

Accessibility

Screen readers hear a combobox, collapsed or expanded. Focus stays on it while the arrows move through the list, and each option is announced as you reach it.

KeyWhat it does
TabMoves focus to the select.
↓ / ↑Opens the list, then moves through it, skipping disabled options.
Enter / SpaceOpens the list, or chooses the highlighted option.
EscapeCloses the list and keeps focus on the select.

Props

PropTypeDefaultDescription
modelValuestring | number | null—The chosen value.
options{ value, label, disabled? }[]—The choices, in order.
placeholderstring—Shown until something is chosen.
size'sm' | 'lg''sm'36px or 44px tall.
disabledbooleanfalseGreys the select and blocks it.
errorboolean | stringfalseRed border; a string also shows the message.

Tokens

TokenValueWhere it lands
--radius-lg8pxThe trigger’s corners, and the list’s.
--color-border-default#E6E6E6Border at rest.
--global-blue-1000#1877F2Border when focused or open.
--color-error#E12121Border on error.
--font-size-sm12pxValue at sm.
--font-size-md13pxValue at lg, and every option.
--color-grey-200#F1F1F1Highlighted and chosen options.
--global-blue-1100#0C296AThe chosen option’s text, 12.07:1 on the grey row (blue-1000 would be 3.75:1).
--color-primary-active#1877F2Ring on the highlighted option.
--shadow-dropdown0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04)The open list.