Multi SelectNew
A searchable multi-select with inline chips — the component shadcn never shipped. Type to filter, Enter to toggle, Backspace to peel off the last chip, plus Select all, a +N more overflow collapse, and creatable tags.
Preview & playground
Edit the code — the preview updates live. Try changing props, text, or classes.
function Demo() { const [value, setValue] = useState(["react", "ts"]) const skills = [ { value: "react", label: "React", group: "Frontend" }, { value: "vue", label: "Vue", group: "Frontend" }, { value: "svelte", label: "Svelte", group: "Frontend" }, { value: "node", label: "Node.js", group: "Backend" }, { value: "go", label: "Go", group: "Backend" }, { value: "rust", label: "Rust", group: "Backend" }, { value: "ts", label: "TypeScript", group: "Languages" }, { value: "py", label: "Python", group: "Languages" }, ] return ( <div className="w-80"> <MultiSelect options={skills} value={value} onValueChange={setValue} placeholder="Add skills…" maxDisplay={3} /> </div> ) } render(<Demo />)
Examples
Common variations — edit any of them live.
Capped selection
Limit how many options can be chosen — the counter and Select all adapt.
function Demo() { const [value, setValue] = useState(["email"]) const channels = [ { value: "email", label: "Email" }, { value: "sms", label: "SMS" }, { value: "push", label: "Push" }, { value: "slack", label: "Slack" }, { value: "webhook", label: "Webhook" }, ] return ( <div className="w-80"> <MultiSelect options={channels} value={value} onValueChange={setValue} maxSelected={3} placeholder="Up to 3 channels" /> </div> ) } render(<Demo />)
Creatable tags
Type a new label and add it as a fresh chip on the fly.
function Demo() { const [options, setOptions] = useState([ { value: "bug", label: "bug" }, { value: "feature", label: "feature" }, { value: "docs", label: "docs" }, ]) const [value, setValue] = useState(["bug"]) return ( <div className="w-80"> <MultiSelect options={options} value={value} onValueChange={setValue} creatable onCreate={(input) => { const opt = { value: input.toLowerCase(), label: input } setOptions((o) => [...o, opt]) setValue((v) => [...v, opt.value]) }} placeholder="Label this issue…" /> </div> ) } render(<Demo />)
Installation
Copy the source into your project with the registry CLI:
$pnpm dlx shadcn@latest add @stacklyui/multi-selectOr install the package and import it:
$pnpm add @stacklyui/ui motionUsage
Selected values live as removable chips right inside the control. Type to filter, Enter to toggle the highlighted option, and Backspace on an empty search peels off the last chip. Use maxDisplay to collapse extra chips into a +N more badge, maxSelected to cap choices (with a live counter), and showSelectAll for a header toggle. Group options with group, add keywords for search, and enable creatable + onCreate for ad-hoc tags. The dropdown is a self-contained, portal-positioned panel — no Radix. Controlled via value + onValueChange or uncontrolled via defaultValue.