feat(components): add multi-select component#9017
Open
successbyte wants to merge 2 commits intoshadcn-ui:mainfrom
Open
feat(components): add multi-select component#9017successbyte wants to merge 2 commits intoshadcn-ui:mainfrom
successbyte wants to merge 2 commits intoshadcn-ui:mainfrom
Conversation
Contributor
|
@successbyte is attempting to deploy a commit to the shadcn-pro Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Author
|
@shadcn whenever you have a moment, could you please review this multi-select component PR? Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(components): add multi-select
Summary
Adds a new
Multi-selectcomponent built from existing shadcn primitives (Popover,Command,Checkbox,Badge,Button) for selecting multiple options from a searchable list.Closes #8889.
Closes #66.
Video Demo
multi-select.webm
Component API
MultiSelectvalue: string[],onValueChange: (value: string[]) => void,children.openstate for the popover internally.MultiSelectTriggerButton+PopoverTrigger.role="combobox"andaria-expanded={open}.MultiSelectValueoptions: { value: string; label: React.ReactNode }[],placeholder?: React.ReactNode,maxBadges?: number,className?,children?.+N morewhen truncated.MultiSelectContentPopoverContentandCommand.PopoverContentprops plussearchPlaceholder?: string.MultiSelectGroup,MultiSelectLabelCommandGroupand adivlabel for grouping options.MultiSelectItemvalue: string,label?: React.ReactNode,children?,className?,disabled?,showCheckbox?: boolean.value(supports clearing via"__none__"convention).Implementation details
apps/v4/registry/new-york-v4/ui/multi-select.tsx.Popover,Command,Checkbox,Badge,Buttonfrom@/registry/new-york-v4/ui/*.apps/v4/registry/new-york-v4/ui/_registry.tsasmulti-selectwith:type: "registry:ui".files: [{ path: "ui/multi-select.tsx", type: "registry:ui" }].registryDependencies: ["badge", "button", "checkbox", "command", "popover"].apps/v4/registry/new-york-v4/examples/multi-select-demo.tsx.apps/v4/registry/new-york-v4/examples/_registry.tsasmulti-select-demo.apps/v4/app/(internal)/sink/components/multi-select-demo.tsx(marked"use client").apps/v4/app/(internal)/sink/component-registry.tsunder key"multi-select"pointing to/sink/multi-select.apps/v4/content/docs/components/multi-select.mdxwith:title,description,component: true.npx shadcn@latest add multi-select.<ComponentSource name="multi-select" title="components/ui/multi-select.tsx" />.aria-expanded, keyboard support viaCommand, and selection feedback viaCheckbox+ badges."/docs/components/multi-select"toPAGES_NEWinapps/v4/lib/docs.ts.pnpm registry:buildto update:apps/v4/public/r/styles/new-york-v4/registry.json.apps/v4/public/r/styles/new-york-v4/multi-select.json.apps/v4/public/r/styles/new-york-v4/multi-select-demo.json.Accessibility
role="combobox"andaria-expandedto expose open state.Commandfor keyboard navigation (arrow keys, typeahead, Enter).Checkboxand a trailingCheckIconto clearly indicate selected state.MultiSelectValueuses badges to summarize the current selection in a compact, screen‑reader friendly way (labels come from theoptionsmap).