Components

Combobox

A combobox is a typeable field with a filterable list — the same keyboard contract as Select, but the query narrows the options. This recipe covers the generic pattern; Event search adds inline creation on top.

Anatomy

  • Ana Ferreira
  • André Silva
  • No athlete matches "ann"

Input matches Input exactly. List matches Select content — 4px radius, popover shadow, highlighted row = surface-muted, not accent tint.

Specification

PropertyValueWhy
Recipecombobox({ scale, rowHeight, invalid })Visual layer — Radix Combobox or ARIA 1.2 pattern for behaviour
InputSame as Input per scaleOne field voice across the system
Listz-dropdown, max-h-72, native scrollSame cap as Select — menu must not cover the field
Highlightsurface-mutedColour stays reserved for meaning
Emptyempty slot, caller copy requiredNo default string in ui — same rule as Select

Structure

<label for="athlete">Choose an athlete</label>
<div class={c.field()}>
  <Combobox.Input class={c.input()} placeholder={placeholder} />
  <Combobox.Content class={c.content()}>
    <Combobox.Item class={c.item()} value="ana">Ana Ferreira</Combobox.Item>
    <Combobox.Empty class={c.empty()}>{emptyText}</Combobox.Empty>
  </Combobox.Content>
</div>

Required props

Same rule as Select

placeholder and emptyText are required props at the wrapper. A string literal in ui/src/ is a defect. Example empty copy: No athlete matches "…" — name the query, say what failed.

Props

PropTypeDefaultNotes
scale'md' | 'sm''md'44px touch floor at md
rowHeight'inherit' | 'compact' | 'touch''inherit'touch keeps 44px list rows on mobile
invalidbooleanfalseDestructive border on the input

Rules

  • No inline creation here. The create row is Event Search's duplicate-prevention job — see Event search.
  • Same keyboard contract as search and multi-select. Arrow keys, Enter to select, Esc to close. Two comboboxes in one panel must behave identically.
  • Empty is a real state. Say what was searched and that nothing matched — not a blank list.
  • Do not offer creation while loading or on error. See Event Search state machine; the generic combobox has no create row at all.

See also: Select · Multi-select · Event search

Sporting Scouter Design System
Every token on this site is generated from theme.css.