Skip to content
nexubDesign System
v11.9.0

Components · Form Controls

Multi Select

BetaAdded v5.2.0

Pick several options as chips, with search, "+N more" and an optional create option.

import { MultiSelect } from '@nexub/react';
View as Markdown

Playground

Props

size
BugAccessibility
TSX
<MultiSelect aria-label="Labels" options={options} value={value} onValueChange={setValue} onCreate={…} placeholder="Add labels…" />

Examples

Labels with create

BugAccessibility
Aisha Rahman

States

  • BugAccessibility
    default
  • BugAccessibility
    disabled
  • BugAccessibility
    readOnly
  • BugAccessibility
    loading
  • BugAccessibility
    size="sm"
  • BugAccessibility
    size="md"
  • BugAccessibility
    size="lg"

Props

Props
PropTypeDefaultDescription
optionsrequiredMultiSelectOption[]—The options to pick from.
valuestring[]—Selected values, controlled or not.
defaultValuestring[]—Selected values, controlled or not.
onValueChange((value: string[]) => void)—Called with the new selection.
maxVisibleChipsnumber3Chips shown before the rest collapse into "+N more".
onInputChange((text: string) => void)—Called as the user types. When set, options are shown as given, so you can fetch them.
onCreate((text: string) => void)—Adds a "Create “text”" option when the text matches no option.
loadingbooleanfalseSkeleton rows instead of options; "Loading" is announced.
aria-labelstring—Name the field: there is no visible label inside it.
aria-labelledbystring—Name the field: there is no visible label inside it.
onSearch((text: string) => void)—11.2: async search (same as onInputChange); picked values keep their labels and avatars.
options[].description / disabled / avatarstring / boolean / ReactNode—11.2: a second line (also searched), options that can't be picked, and an avatar in the list and on the chip.
classNamestring—
disabledboolean—
emptyTextstring—
idstring—
inputValuestring—Controlled search text.
placeholderstring—
readOnlyboolean—Shows the chips but nothing can be added or removed; stays focusable.
sheetfalse | true | 'auto''auto' (pass `sheet={false}` to keep a popover on small screens)true: bottom sheet. 'auto': bottom sheet below the md breakpoint, a popover above.
size'sm' | 'md' | 'lg''md'

Accessibility

Keyboard

  • Type

    Filters the options and opens the list.

  • ArrowDown / ArrowUp

    Moves through the options.

  • Enter

    Toggles the highlighted option.

  • Backspace

    In an empty field, removes the last chip.

  • Escape

    Closes the list.

Screen reader

  • Options carry `aria-checked`; each chip has a "Remove <label>" button.