Skip to content

MultiSelect

Multiple selection component with search, chips display, and modal picker.

Also known as: multi picker, multiple selection, multi dropdown, tag selector

View in Storybook

When to use

  • Selecting multiple options from a list via modal picker. For free-form tags, use Tags.
  • For a simple group of checkboxes, use CheckboxGroup.

Import

tsx
import { MultiSelect } from '@vacano/ui'

Usage

tsx
const [values, setValues] = useState<string[]>([])

const options = [
  { value: 'react', label: 'React' },
  { value: 'vue', label: 'Vue' },
  { value: 'angular', label: 'Angular' },
  { value: 'svelte', label: 'Svelte' },
]

<MultiSelect
  value={values}
  options={options}
  onChange={setValues}
  placeholder="Select frameworks"
/>

With Label

tsx
<MultiSelect
  label="Technologies"
  value={values}
  options={options}
  onChange={setValues}
/>

Max Visible Chips

Limit the number of visible chips:

tsx
<MultiSelect
  value={['react', 'vue', 'angular']}
  options={options}
  onChange={setValues}
  maxVisible={2}
/>

Custom Empty Message

tsx
<MultiSelect
  value={values}
  options={options}
  onChange={setValues}
  emptyMessage="No frameworks found"
/>

Custom Modal Title

tsx
<MultiSelect
  value={values}
  options={options}
  onChange={setValues}
  modalTitle="Choose Frameworks"
/>

Search Placeholder

tsx
<MultiSelect
  value={values}
  options={options}
  onChange={setValues}
  searchPlaceholder="Search frameworks..."
/>

Variants

tsx
<MultiSelect variant="normal" value={[]} options={options} onChange={() => {}} />
<MultiSelect variant="error" value={[]} options={options} onChange={() => {}} />

With Message

tsx
<MultiSelect label="Skills" variant="error" value={[]} options={options} onChange={() => {}} message="Please select at least one skill" />
<MultiSelect label="Interests" value={[]} options={options} onChange={() => {}} message="Optional field" />

Disabled

tsx
<MultiSelect disabled value={['react']} options={options} onChange={() => {}} />

Props

PropTypeDefaultDescription
valuestring[]requiredSelected values
optionsMultiSelectOption[]requiredArray of options
onChange(value: string[]) => voidrequiredChange handler
labelstring-Label text
placeholderstring'Select...'Placeholder text
variant'normal' | 'error''normal'Visual variant
disabledbooleanfalseDisable component
messagestring-Message text below component (error, hint)
maxVisiblenumberInfinityMax visible chips before showing "+N" overflow
emptyMessageReactNode'No options found'Empty state message when search has no results
searchPlaceholderstring'Search...'Search input placeholder text
modalTitlestring'Select options'Modal header title
classNamestring-CSS class name for the root element
classnamesMultiSelectClassNames-Custom class names for inner elements
refRef<HTMLDivElement>-Ref to the root container element
data-test-idstring-Test identifier attribute

Option Type

tsx
type MultiSelectOption = {
  value: string
  label: string
  disabled?: boolean
}

ClassNames

KeyDescription
triggerTrigger container
chipsChips container
chipIndividual chip
placeholderPlaceholder text
modalModal container
searchSearch input
optionsOptions list
optionIndividual option
emptyEmpty state

Released under the MIT License.