Select
A common form component for choosing a predefined value in a dropdown menu.
Installation
pnpm dlx shadcn@latest add @lumi-ui/select
Basic Usage
import {
Select,
SelectContent,
SelectItemContent,
SelectTriggerGroup,
} from "@/components/ui/select";<Select>
<SelectTriggerGroup placeholder="Select a fruit" />
<SelectContent>
<SelectItemContent value="Apple">Apple</SelectItemContent>
</SelectContent>
</Select>Anatomy
<Select>
<SelectTriggerGroup />
<SelectContent>
<SelectGroup>
<SelectGroupLabel />
<SelectItemContent />
</SelectGroup>
</SelectContent>
</Select>Features
Item Aligned
Custom Trigger
Scrollable
Multiple selection
Add the multiple prop to the <Select> component to allow multiple selections.
With Groups
Use SelectGroup and SelectGroupLabel to organize items into sections.
This component uses the animate-popup utility class to ensure consistency with other overlays. You can customize transitions, easing, and duration in css file. See details in Animation Guide.
States
Disabled
Invalid
Cookbook
Custom Render
You can customize the rendered content while still using the items prop for accessibility.
Controlled
Control the value state programmatically.
Track State
You can track the state of the select and use it to display additional information.
Form Integration
API Reference
Primitives
Composite Components
SelectTriggerGroup
A high-level trigger component that combines the Trigger, Value, and Icon into a single styled element. It handles sizing, icons, and placeholder text automatically.
SelectContent
A composite component that wraps the Portal , Positioner, Popup, List, and scroll buttons.
SelectItemContent
A convenience component for list items. It combines the Item, ItemText, and ItemIndicator (check icon) into a single component, managing styles and layouts for selected states.