Multi Select
MultiSelect lets users choose several options from a dropdown.
import { MultiSelect } from '@/components/ui/wideset/multi-select/MultiSelect';
<MultiSelect
options={[
{ value: 'design', label: 'Design' },
{ value: 'engineering', label: 'Engineering' },
{ value: 'marketing', label: 'Marketing' },
{ value: 'sales', label: 'Sales' },
]}
defaultValue={['design', 'engineering']}
placeholder="Select teams"
/>Installation
pnpm dlx wideset add multi-select
Copies the component and any Wideset components it uses into your project.
Examples
Variants
Primary is the default. Danger marks a selection that failed validation, such as none chosen where at least one is required; put the reason in the FormField's errorText, which FormField links to the control, because the red border alone does not reach screen reader users.
import { MultiSelect } from '@/components/ui/wideset/multi-select/MultiSelect';
const TEAMS = [
{ value: 'design', label: 'Design' },
{ value: 'engineering', label: 'Engineering' },
{ value: 'marketing', label: 'Marketing' },
{ value: 'sales', label: 'Sales' },
];
export default function MultiSelectVariants() {
return (
<div className="gap-ws-12 flex w-[20rem] max-w-full flex-col">
{(['primary', 'danger'] as const).map((variant) => (
<MultiSelect
key={variant}
variant={variant}
options={TEAMS}
placeholder="Select teams"
aria-label="Teams"
/>
))}
</div>
);
}Presets
Border is the default, for a multi-select in a form or on the page. Ghost drops the frame and shows a soft background on hover, for a filter inside a surface that already has one, such as a toolbar or a table header.
import { MultiSelect } from '@/components/ui/wideset/multi-select/MultiSelect';
const TEAMS = [
{ value: 'design', label: 'Design' },
{ value: 'engineering', label: 'Engineering' },
{ value: 'marketing', label: 'Marketing' },
{ value: 'sales', label: 'Sales' },
];
export default function MultiSelectPresets() {
return (
<div className="gap-ws-12 flex w-[20rem] max-w-full flex-col">
{(['border', 'ghost'] as const).map((preset) => (
<MultiSelect
key={preset}
preset={preset}
options={TEAMS}
defaultValue={['design', 'engineering']}
aria-label="Teams"
/>
))}
</div>
);
}Sizes
Medium is the default for forms. Small fits filter bars and dense tables, large a short form that is the main task on the page. Tags follow the field's size; match it to the controls next to it.
import { MultiSelect } from '@/components/ui/wideset/multi-select/MultiSelect';
const TEAMS = [
{ value: 'design', label: 'Design' },
{ value: 'engineering', label: 'Engineering' },
{ value: 'marketing', label: 'Marketing' },
{ value: 'sales', label: 'Sales' },
];
export default function MultiSelectSizes() {
return (
<div className="gap-ws-12 flex w-[20rem] max-w-full flex-col">
{(['sm', 'md', 'lg'] as const).map((size) => (
<MultiSelect
key={size}
size={size}
options={TEAMS}
defaultValue={['design', 'engineering']}
aria-label="Teams"
/>
))}
</div>
);
}Selection
By default every choice is a tag and the field grows to fit them. maxVisibleTags keeps the field one line high: past that count the tags collapse into a summary such as “3 teams”, and 0 always shows the summary. Pick the summary where the field sits in a fixed-height row. Each tag carries its own remove control, so a choice can go without opening the list.
import { MultiSelect } from '@/components/ui/wideset/multi-select/MultiSelect';
const TEAMS = [
{ value: 'design', label: 'Design' },
{ value: 'engineering', label: 'Engineering' },
{ value: 'marketing', label: 'Marketing' },
{ value: 'sales', label: 'Sales' },
];
const CHOSEN = ['design', 'engineering', 'marketing'];
export default function MultiSelectSelection() {
return (
<div className="gap-ws-12 flex w-[20rem] max-w-full flex-col">
<MultiSelect options={TEAMS} defaultValue={CHOSEN} aria-label="Teams" />
<MultiSelect
options={TEAMS}
defaultValue={CHOSEN}
maxVisibleTags={2}
multiValuesLabel="teams"
aria-label="Teams"
/>
</div>
);
}States
Hover, press and focus are live. Disabled blocks the trigger and every option, and hides the clear button; to lock a single choice instead, set disabled on that option.
import { MultiSelect } from '@/components/ui/wideset/multi-select/MultiSelect';
const TEAMS = [
{ value: 'design', label: 'Design' },
{ value: 'engineering', label: 'Engineering' },
{ value: 'marketing', label: 'Marketing' },
];
export default function MultiSelectStates() {
return (
<div className="gap-x-ws-7 gap-y-ws-5 grid w-[28rem] max-w-full grid-cols-[4.5rem_1fr] items-center">
<span className="typography-caption-md text-ws-static-subtle">Default</span>
<MultiSelect options={TEAMS} defaultValue={['design']} clearable aria-label="Teams" />
<span className="typography-caption-md text-ws-static-subtle">Disabled</span>
<MultiSelect
options={TEAMS}
defaultValue={['design']}
clearable
disabled
aria-label="Teams"
/>
</div>
);
}API reference
MultiSelect
| Name | Description | Default |
|---|---|---|
children | Sub-components for composable usage (`MultiSelect.Trigger`, `MultiSelect.Content`, `MultiSelect.Option`, etc.). Use instead of `options` when you need full rendering control. ReactNode | — |
className | Additional CSS classes applied to the trigger element. string | — |
clearable | Whether to show a clear button when at least one value is selected. boolean | — |
clearSelectionAriaLabel | Accessible label for the clear-selection button. Defaults to `'Clear selection'`. string | 'Clear selection' |
defaultMotion | Turns the component's built-in animations on or off. When omitted, inherits the value from the nearest `MotionProvider`. boolean | true |
defaultOpen | Initial open state for uncontrolled usage. boolean | — |
defaultValue | Initial selected values for uncontrolled usage. string[] | — |
deselectAllLabel | Label for the "select all" toggle when all options are selected. Defaults to `'Deselect all'`. string | 'Deselect all' |
disabled | Disables the trigger and all options. boolean | — |
hasSearch | Whether to show a search input at the top of the dropdown that filters options by label. boolean | false |
hasSelectAll | Whether to show a "Select all" / "Deselect all" option at the top of the dropdown. When used with `hasSearch`, applies only to the currently visible (filtered) options. boolean | false |
hideArrow | Whether to hide the dropdown arrow icon on the right side of the trigger. boolean | — |
id | HTML `id` attribute for the trigger element, useful for form label association. string | — |
maxVisibleTags | Controls how selected values are displayed in the trigger: - **`undefined` (default)** — all tags are always shown; the trigger grows in height to fit them. - **`0`** — always shows the aggregated summary label (e.g. `"3 values selected"`), never individual tags. - **`>= 1`** — shows individual tags while the count is within this limit; collapses to the summary label once exceeded. number | — |
modal | Whether the dropdown should be modal, blocking interaction with the rest of the page when open. boolean | — |
multiValuesLabel | Label used in the aggregated summary text, e.g. setting `"countries"` produces `"3 countries"`. Defaults to `"value selected"` / `"values selected"` (pluralized automatically) when omitted. string | — |
name | HTML `name` attribute forwarded for form submission. string | — |
noResultsLabel | Label shown when `hasSearch` is enabled and the search query matches no options. Pass a translated string for internationalization. Defaults to `"No results found"`. string | 'No results found' |
onClear | Called when the clear button is clicked. (() => void) | — |
onOpenChange | Called when the dropdown opens or closes. ((open: boolean) => void) | — |
onValueChange | Called when the selection changes. Receives the updated array of selected values. ((value: string[]) => void) | — |
open | Controlled open state of the dropdown. Use with `onOpenChange` to manage open/close externally. boolean | — |
options | Array of options to display in the dropdown. Each item requires `value` and `label`. MultiSelectOptionType<Record<string, unknown>>[] | — |
placeholder | Placeholder text shown in the trigger when no option is selected. string | — |
portalContainer | DOM node to portal the dropdown content into. Defaults to `document.body`. Element | DocumentFragment | — |
preset | Visual style preset. `border` adds a visible border and background; `ghost` uses a transparent background. 'border''ghost' | — |
selectAllLabel | Label for the "select all" toggle when no options (or some) are selected. Defaults to `'Select all'`. string | 'Select all' |
size | Controls the height, padding, and typography size of the trigger and tags. 'sm''md''lg' | — |
value | Controlled selected values. Each element must match an option's `value`. Use with `onValueChange`. string[] | — |
variant | Color variant. `danger` applies error styling for form validation feedback. 'primary''danger' | 'primary' |
Radix DropdownMenu.Portal is passed through to it. See Radix DropdownMenu.Portal.MultiSelect.Content
| Name | Description | Default |
|---|---|---|
defaultMotion | Turns the component's built-in animations on or off. When omitted, inherits the value from the nearest `MotionProvider`. boolean | true |
portalContainer | DOM node to portal the dropdown content into. Defaults to `document.body`. Element | DocumentFragment | — |
position | Controls how the dropdown is positioned relative to the trigger. 'item-aligned''popper' | — |
shouldUsePrimitive | Internal flag — set to `false` to render as a `DropdownMenu.Content` instead of the Radix Select portal (used inside Dropdown). boolean | — |
MultiSelect.Group
MultiSelect.Label
| Name | Description | Default |
|---|---|---|
inset | Indents the label so it aligns with item text in menus that have a leading icon or checkmark slot. boolean | — |
MultiSelect.Option
| Name | Description | Default |
|---|---|---|
isDisabled* | Whether the option is disabled and uninteractable. boolean | — |
onSelect* | Called when the option is selected or deselected. () => void | — |
option* | The option data to render. MultiSelectOptionType<Record<string, unknown>> | — |
defaultMotion | Turns the component's built-in animations on or off. When omitted, inherits the value from the nearest `MotionProvider`. boolean | true |
MultiSelect.Separator
MultiSelect.Trigger
MultiSelect.Value
| Name | Description | Default |
|---|---|---|
areTagsVisible* | Whether individual tags should be rendered (true when selection count is within `maxVisibleTags`). boolean | — |
hasValue* | Whether any values are currently selected. boolean | — |
onRemoveValue* | Called when a tag's remove button is activated. (value: string) => void | — |
selectedOptions* | Currently selected options with their labels for display. { value: string; label: string; }[] | — |
size* | Size inherited from the parent MultiSelect. 'sm''md''lg' | — |
defaultMotion | Turns the component's built-in animations on or off. When omitted, inherits the value from the nearest `MotionProvider`. boolean | true |
hasClearButton | Whether a clear button sits over the value. For custom compositions that place their own clear button there; `MultiSelect` does not set it. boolean | — |
multiValuesLabel | Label used in the aggregated summary text. string | — |
placeholder | Placeholder text shown when no values are selected. string | — |
wrap | When true, tags wrap to multiple lines and the trigger grows in height. boolean | — |
Accessibility
- Name it:
FormFieldhtmlFor+idon MultiSelect (it lands on the trigger), oraria-label. - Options are menu checkbox items: Space or Enter toggles, arrows move, the menu stays open.
| Part | Renders | Description |
|---|---|---|
| MultiSelectRenders no element | Radix DropdownMenu.Portal | A selection control for multiple options. |
| MultiSelect.ContentRenders no element | — | `MultiSelect.Content` is `Select.Content`; same props. |
| MultiSelect.GroupRenders no element | — | `MultiSelect.Group` is `DropdownMenu.Group`; same props. |
| MultiSelect.LabelRenders no element | — | `MultiSelect.Label` is `DropdownMenu.Label`; same props. |
| MultiSelect.OptionRenders no element | — | A selectable option within the dropdown. |
| MultiSelect.SeparatorRenders no element | — | `MultiSelect.Separator` is `DropdownMenu.Separator`; same props. |
| MultiSelect.TriggerRenders no element | — | `MultiSelect.Trigger` is `DropdownMenu.Trigger`; same props. |
| MultiSelect.ValueRenders no element | — | The rendered selected values and their labels. |
import { MultiSelect } from '@/components/ui/wideset/multi-select/MultiSelect';
<MultiSelect
options={[
{ value: 'design', label: 'Design' },
{ value: 'engineering', label: 'Engineering' },
{ value: 'marketing', label: 'Marketing' },
{ value: 'sales', label: 'Sales' },
]}
defaultValue={['design', 'engineering']}
placeholder="Select teams"
/>