A form select with a two-layer proximity highlight (selected accent tint + muted hover), drawn check animation, and a trigger label morph on selection change.
Dependencies
Interaction Type
Click the trigger to open. Hover or use arrow keys to navigate items. Click or press Enter to select. The trigger label morphs when selection changes.
Props
Options you can pass to customize this component.
valueControlled selected value.
defaultValueInitial selected value for uncontrolled usage.
onValueChangeCalled when the selection changes.
disabledDisables all items. Defaults to false.
nameName for the hidden native <select> (form integration).
requiredRequired for form validation. Defaults to false.
Installation
How to use
import {
Select,
SelectTrigger,
SelectValue,
SelectContent,
SelectItem,
} from "@/components/ui/select"
export function Demo() {
const [value, setValue] = useState("")
return (
<Select value={value} onValueChange={setValue}>
<SelectTrigger>
<SelectValue placeholder="Choose size" />
</SelectTrigger>
<SelectContent>
<SelectItem value="small">Small</SelectItem>
<SelectItem value="medium">Medium</SelectItem>
<SelectItem value="large">Large</SelectItem>
</SelectContent>
</Select>
)
}Source Code
Click the code icon in the top-right corner to view the source code.
License & Usage
// No code loaded.Selected: none