Pick several options from a searchable list; the picks show as removable chips.
$ pnpm dlx shadcn@latest add https://dashral.com/r/multi-select.jsonInstallation
$ pnpm dlx shadcn@latest add https://dashral.com/r/multi-select.jsonAdds the component, the components it builds on, its npm packages and the theme tokens it uses. Using Dashral often? Add the registry to components.json once:
{
"registries": {
"@dashral": "https://dashral.com/r/{name}.json"
}
}Then add components by name:
$ pnpm dlx shadcn@latest add @dashral/multi-selectUsage
import { MultiSelect } from "@/components/dashral/multi-select"
<MultiSelect
label="Labels"
defaultValue={["bug"]}
options={[
{ value: "bug", label: "Bug" },
{ value: "feature", label: "Feature" },
{ value: "docs", label: "Docs" },
]}
/>Examples
Limited picks
maxSelected caps the picks; maxShown collapses the rest into +N.
API reference
MultiSelect
| Prop | Type | Default |
|---|---|---|
options | { value: string; label: string; disabled?: boolean }[]Required. | — |
value / defaultValue | string[]Picked values, controlled or initial. | [] |
onValueChange | (value: string[]) => voidCalled with the new value. | — |
maxShown | numberChips shown before the rest collapse into “+N”. | 3 |
maxSelected | numberAt most this many picks. | — |
placeholder / searchPlaceholder / emptyText | string | — |
id / disabled / aria-label / className | className styles the box. | — |
label | ReactNodeShown above, linked to the control. | — |
description | ReactNodeA hint under the control. | — |
error | boolean | ReactNodetrue shows the error style; a message also shows under the control. | — |
labelAction | ReactNodeAt the end of the label's row, e.g. a “Forgot password?” link or the current value. | — |
withAsterisk | booleanMarks the label with an asterisk, e.g. alongside required. | false |
classNames | { root, label, description, error, box, content, item }Classes for each part. | — |
Keyboard
| Keys | Action |
|---|---|
| EnterorSpaceor↓ | Open the list |
| Type | Filter the list |
| ↓or↑ | Move through the options |
| Enter | Pick or unpick the highlighted option |
| Backspace | Remove the last pick (on the closed field) |
| Tab | Reach each chip's remove button |
| Escape | Close |
Accessibility
- Picked options say “selected”; each chip's remove button names the option; the trigger says how many are picked.
Motion
- Opens with a fade, a scale from 95%, a 2px blur clearing and a 4px slide from its trigger's side, on the spring (--duration-standard); closes faster (--duration-fast, --ease-exit). No blur with reduced motion.