-
Notifications
You must be signed in to change notification settings - Fork 92
Open
Description
π Feature Request: Single Selection Mode
Problem
The current MultiSelect component is designed exclusively for multi-selection. However, there are use cases where a searchable single-select is needed β something a basic <select> or shadcn Select component doesn't provide out of the box.
Proposed Solution
Add a singleSelect (or mode: "single" | "multi") prop that:
- Limits selection to one item at a time
- Keeps the search/filter functionality intact
- Automatically closes the popover after selection (like
closeOnSelect) - Clears the previous selection when a new item is picked
- Still supports all existing props:
searchable,placeholder,disabled,emptyIndicator, etc.
Example Usage
<MultiSelect
options={options}
onValueChange={setSelected}
singleSelect={true}
placeholder="Search and select one..."
/>Why Not Use shadcn Select?
The native shadcn Select component lacks built-in search/filter functionality, making it impractical for large option lists. This component already has the search infrastructure β a singleSelect mode would reuse it elegantly.
Acceptance Criteria
- New
singleSelect?: booleanprop (default:false) - Selecting an item replaces the previous selection
- Popover closes automatically on selection when
singleSelect={true} -
onValueChangestill returnsstring[]for API compatibility (with a single element) - Existing multi-select behaviour is unaffected
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels