Dither / components
Select
Pick one value from a list. Trigger heights match every other control.
- Stable
- 4 variants
- 2 props
- Light & Dark
light
dark
Code
import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue,} from "@/components/ui/select";export default function SelectDemo() { return ( <Select defaultValue="30d"> <SelectTrigger aria-label="Period"> <SelectValue placeholder="Select a period" /> </SelectTrigger> <SelectContent> <SelectGroup> <SelectLabel>Period</SelectLabel> <SelectItem value="7d">Last 7 days</SelectItem> <SelectItem value="30d">Last 30 days</SelectItem> <SelectItem value="90d">Last 90 days</SelectItem> </SelectGroup> <SelectSeparator /> <SelectItem value="custom" disabled>Custom range</SelectItem> </SelectContent> </Select> );}Installation
npx shadcn add @dither/selectUsage
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
<Select>
<SelectTrigger aria-label="Period">
<SelectValue placeholder="Select a period" />
</SelectTrigger>
<SelectContent>
<SelectItem value="30d">Last 30 days</SelectItem>
</SelectContent>
</Select>Guidelines
- Use for 5 to ~10 options; fewer: Radio Group; more or searchable: Combobox.
- Pick a sensible default when there is one; otherwise a placeholder that says what to choose.
- Arrow keys and type-ahead work; the list never covers its own trigger.
Props
Prop
Type
Examples
Sizes
light
dark
Code
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";export default function SelectSizes() { return ( <div className="flex flex-col items-center gap-2"> {(["xs", "sm", "default", "lg"] as const).map((size) => ( <Select key={size}> <SelectTrigger size={size} aria-label={`Team (${size})`}> <SelectValue placeholder={`Team · ${size}`} /> </SelectTrigger> <SelectContent> <SelectItem value="design">Design</SelectItem> <SelectItem value="engineering">Engineering</SelectItem> <SelectItem value="finance">Finance</SelectItem> </SelectContent> </Select> ))} </div> );}