Multi Select

Pick several values from a searchable checkbox list. Selected items show as removable chips on the trigger. For autocomplete-style multi with an inline chip input, use Combobox with multiple.

Gallery

Skills picker card with live chip count — searchable list and removable badges.

Loading…

Installation

CLI
npx @sonojs/ui@latest add multi-select
Also needs
npx @sonojs/ui@latest add badge button command popover
npm i lucide-react

Usage

multi-select.tsx
import { MultiSelect } from "@/components/multi-select"

const frameworks = [
  { value: "next", label: "Next.js" },
  { value: "remix", label: "Remix" },
  { value: "astro", label: "Astro" },
]

export function Example() {
  return (
    <MultiSelect
      options={frameworks}
      defaultValue={["next"]}
      placeholder="Select frameworks…"
    />
  )
}

Props

PropTypeDefaultDescription
optionsMultiSelectOption[]-`{ value, label, disabled? }` items in the list.
valuestring[]-Controlled selected values.
defaultValuestring[][]Initial selection when uncontrolled.
onValueChange(value: string[]) => void-Fires when the selection changes.
placeholderstring"Select…"Trigger text when nothing is selected.
searchPlaceholderstring"Search…"Placeholder for the search field.
emptyTextstring"No results found."Shown when search matches nothing.
searchablebooleantrueShow the search input in the popover.
maxCountnumber-Max chips in the trigger before a `+N more` badge.
disabledbooleanfalseDisables the trigger and chip remove actions.
classNamestring-Merge Tailwind classes on the trigger.

Related

  • Select — single value from a button trigger
  • Combobox — autocomplete multi with `multiple`
  • Field — label and describe the control