Select
Inputshadcn/uiPicks one option from a short list. The trigger looks exactly like Input, so forms stay even.
When to use
- Wrap it in Field with a FieldLabel, like any other input.
- Use it for 4 to 15 options; sort them in a meaningful order.
- Give SelectValue a placeholder that names the choice ('Choose an account').
- Don't use Select for 2 or 3 options; use RadioGroup or Tabs.
- Don't use it for long lists that need search.
- Don't trigger navigation or actions from an option; use a Menu.
Accessibility
- Role
- combobox with a listbox
- Keyboard
- Enter, Space or arrow keys open the menu. Arrow keys move, Enter selects, Escape closes. Typing jumps to the matching option.
- Notes
- Link the FieldLabel to SelectTrigger with htmlFor and id.
Props
value / onValueChangestring / (value: string) => voidControlled value on Select.
size= 'default''default' | 'sm'On SelectTrigger.
aria-invalidbooleanOn SelectTrigger; tints it like an Input with an error.
Prompt for your agent
Use the UnbuiltUI Select. Call unbuilt_get_component("Select") first and follow its spec: variants, states, usage rules and accessibility.
unbuilt_get_component returns
2 variants4 states3 props6 usage rules4 a11y notes12 tokens1 example
Add it with shadcn
$
npx shadcn add https://unbuiltui.com/r/select.jsonTokens · 12
bg.subtlebg.raisedfg.defaultfg.subtlefg.mutedborder.subtleborder.focusdanger.defaultdanger.subtleradius.mdradius.smshadow.raised