Select
Displays a list of options for the user to pick from, triggered by a button.
Installation
bash
npx shadcn@latest add selectImport
import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem, SelectGroup, SelectLabel, SelectSeparator,} from "@/components/ui/select"Basic
Disabled
Props
Select
PROPTYPEDEFAULTDESCRIPTION
valuestring—Controlled selected valueonValueChange(val: string) => void—Called when value changesdefaultValuestring—Initial value (uncontrolled)disabledbooleanfalseDisables the entire selectrequiredbooleanfalseMarks as required in a formSelectContent
PROPTYPEDEFAULTDESCRIPTION
position"popper" | "item-aligned""popper"Positioning mode for the dropdownsidestring—Preferred side of the triggersideOffsetnumber—Offset from the triggerSelectItem
PROPTYPEDEFAULTDESCRIPTION
valuestring—Item value (required)disabledbooleanfalseDisables the itemAccessibility
- Arrow Up/Down navigates items
- Type a character to jump to matching item
- Enter selects the focused item
- Escape closes the dropdown