MultiSelect

A multi-select component built on top of cmdk, with badge-styled tags, creatable options, and keyboard support.

<MultiSelect defaultOptions={options} />

Installation

pnpm add @notion-kit/shadcn

Options


Variant

Use the variant prop to control the layout of the dropdown.
The default variant is "floating".

React
<MultiSelect variant="inline" {...} />

Examples


Creatable

Allow users to create new options on-the-fly by typing a name that doesn't exist.

<MultiSelect creatable {...} />

Max Selected

Limit the number of selections with the maxSelected prop.

<MultiSelect maxSelected={3} {...} />

API Reference

MultiSelect

PropTypeDefaultDescription
variant"floating" | "inline""floating"Layout variant. "floating" renders a dropdown popover; "inline" renders the list directly below the input.
valueMultiSelectOption[][]Controlled selected options.
defaultOptionsMultiSelectOption[][]Default list of options to display.
optionsMultiSelectOption[]-Manually controlled options. Overrides defaultOptions when provided.
placeholderstring-Placeholder text for the input.
emptyIndicatorReact.ReactNode-Content shown when no options match the search.
onChange(options: MultiSelectOption[]) => void-Called when the selection changes.
maxSelectednumberInfinityMaximum number of selectable options.
onMaxSelected(maxLimit: number) => void-Called when the user tries to exceed maxSelected.
hidePlaceholderWhenSelectedbooleanfalseHide the placeholder when options are selected.
hideClearAllButtonbooleanfalseHide the "clear all" button.
disabledbooleanfalseDisable the entire component.
groupBystring-Group options by a key on MultiSelectOption.
classNamestring-Class name for the root element.
classNames{ badge?, input?, content?, group?, item? }-Class names for individual slots.
selectFirstItembooleantrueWhether the first item is auto-selected (cmdk default). Set false to disable.
creatablebooleanfalseAllow creating new options when no match is found.
keepSelectedInListbooleanfalseKeep selected options visible in the dropdown. Clicking toggles selection.
commandPropsCommandProps-Props forwarded to the inner Command component.
inputPropsCommandInputProps-Props forwarded to the inner CommandPrimitive.Input.
renderOption(props: { option, isSearching }) => React.ReactNode-Custom renderer for each option in the dropdown list.

type MultiSelectOption

PropTypeDescription
value*stringUnique value identifier.
label*stringDisplay label.
disabledbooleanWhether the option is disabled.
fixedbooleanFixed options cannot be removed.
colorstringBackground color for the option badge.

Keyboard Navigation

KeyAction
Backspace / DeleteRemove the last selected tag (when input is empty).
EscapeBlur the input and close the dropdown.
EnterSelect the highlighted option.
/ Navigate between options (handled by cmdk).