Select / Combobox
A fully reusable, accessible Select and Combobox component with search, multi-select, and virtualization support.
form@radix-ui/react-popover@radix-ui/react-slot@tanstack/react-virtualclass-variance-authoritycmdkframer-motionlucide-react
Installation
$npx futureuikit add select
Import
import { Select } from "@/components/ui/select"
Layout Variant
Color Theme
Shape
Size
Spacing
Named Keys & Props
Pass these exact named keys as props on <Select />. Click any color pill to copy the prop.
colorDefault is "default"(Black & White)variantVisual style"solid""outline""ghost""link"shapeCorner shape"default""square""rounded""sharp"spacingInner spacing"default""2x""4x""6x""8x"sizeComponent size"default""sm""md""lg""xl"Usage Example
A basic implementation example to get you started.
Example Implementation
import { Select, SelectTrigger, SelectContent, SelectSearch, SelectList, SelectGroup, SelectItem } from"@/components/ui/select";
export default function Example() {
return (
<Select>
<SelectTrigger placeholder="Select an option..."/>
<SelectContent>
<SelectSearch placeholder="Search options..."/>
<SelectList>
<SelectGroup heading="Options">
<SelectItem value="1">Option 1</SelectItem>
<SelectItem value="2">Option 2</SelectItem>
<SelectItem value="3">Option 3</SelectItem>
</SelectGroup>
</SelectList>
</SelectContent>
</Select>
);
}Features
Key capabilities and highlights.
Key Capabilities
- ◆Built on top of Radix UI Popover and cmdk.
- ◆Supports searchable, multi-select dropdowns.
- ◆Includes virtualization for handling thousands of items.
- ◆Accessible with keyboard navigation and ARIA roles.
Notes
Important implementation details to consider.
Implementation Details
- ◆Overview: The Select component is built on top of Radix UI Popover and cmdk to provide an extremely robust, searchable, multi-select capable dropdown.
- ◆Installation: Run'npx futureuikit add select'to install the component and its dependencies.
- ◆Multi-Select: Simply pass the'multiSelect={true}'prop to <Select> to enable multiple selections. The trigger will automatically render selections as removable tags.
- ◆Search: Enabled by default. Pass'searchable={false}'to <Select> to hide the search input.
- ◆Virtualization: For thousands of items, wrap your options in <SelectVirtualizer> and pass the items and renderItem function.