Design System
Forms

Multi-select

Pick several options from a known list, with the chosen values shown as removable chips and an overflow count once they no longer fit.

Purpose

Several from a known list, searchably. The trigger shows each choice as a removable chip; beyond maxVisible (default 3) the rest collapse into a "+N" badge. The list itself is a search-filtered combobox, so it scales to long lists where a wall of checkboxes would not.

Triage the alternatives first: exactly one from a list is a Select or, searchable, a Combobox; values nobody can enumerate are a Tags input; and for five or fewer options that should all stay visible, a group of Checkboxes beats hiding them behind a click.

Controlled usage
import { MultiSelect } from "@healthmetrics/ui/multi-select";

const [selected, setSelected] = React.useState<string[]>([]);

<MultiSelect
  options={[
    { value: "gp", label: "Outpatient (GP)" },
    { value: "dental", label: "Dental" },
  ]}
  value={selected}
  onValueChange={setSelected}
  placeholder="Select benefit types…"
/>

Async options

While options load, pass loading to show a skeleton list in place of the options — the trigger stays interactive so the layout does not jump when data lands:

Loading options from a query
const { data: clinics, isLoading } = useClinics();

<MultiSelect
  options={clinics ?? []}
  loading={isLoading}
  value={selected}
  onValueChange={setSelected}
  placeholder="Select panel clinics…"
/>

States

Empty, selected with overflow, loading, and disabled. disabled disables the trigger, so the listbox cannot open. There is no error prop — present form-level errors through your form's own error region.

Structure

PropertyValue
Triggeroutline Button, min-height 40px (min-h-10), grows as chips wrap
Chipssecondary Badge; remove target 24px square (size-6), 13px glyph
Overflowoutline "+N" Badge after maxVisible chips (default 3)
Caret18px unfold_more glyph, --muted-foreground
Placeholder--muted-foreground
Listbox--popover surface, width matches the trigger, zero padding
Option marker16px checkbox square; --primary fill + 13px check when selected
Loadingthree skeleton lines in place of the options

Best practices

Do

  • Pair the trigger with a Label via the id prop — chips are values, not a name for the field.
  • Keep label text short — chips wrap and tall triggers push the form around.
  • Raise maxVisible only when the field is wide; "+N" exists so ten choices do not become ten rows.
  • Pass loading while options fetch instead of rendering an empty list that says "No results found."

Don't

  • Use it for a single choice — that is a Select or Combobox.
  • Use it for open-ended values — options are a fixed list; free text is a Tags input.
  • Hide 3 checkboxes behind it — few, fixed options belong visible on the page.

Accessibility & keyboard

  • The trigger is a real button with role="combobox" and aria-expanded; give the field a name with a Label via id.
  • Each chip's remove control is named "Remove label", operable with Enter or Space, and sized 24px square — the WCAG 2.2 AA minimum target (2.5.8).
  • The list is a cmdk command menu: the search field takes focus on open and options are announced as they are filtered; the selected state is marked with a filled check square.
  • The skeleton list is labelled "Loading options" while loading is set.
  • Selecting an option does not close the popover — deliberate, so several choices are one open-close cycle. Esc or clicking away closes.
  • Keyboard: Enter or Space opens with focus in the search field; typing filters; arrow keys move through options; Enter toggles the highlighted option; Esc closes and returns focus to the trigger. On the trigger, Tab reaches each visible chip's remove control.

Props

Options are { value, label } pairs — label is what is displayed and searched.

PropTypeDefaultDescription
optionsrequiredMultiSelectOption[]—Selectable options. `label` is displayed and searched.
valuestring[] | undefined—Currently selected values (controlled).
onValueChange((values: string[]) => void) | undefined——
loadingboolean | undefined—Show a skeleton option list while options load asynchronously.
maxVisiblenumber | undefined3How many selected badges to show on the trigger before collapsing the rest into a "+N" badge.
placeholderstring | undefined"Select…"—
searchPlaceholderstring | undefined"Search…"—
emptyTextstring | undefined"No results found."—
disabledboolean | undefined—Disables the trigger; the listbox cannot open while set.
classNamestring | undefined——
idstring | undefined——

On this page