Select
Choose one option from a short, fixed list.
Default
Pass items so the trigger shows the selected label instead of the raw value.
Sizes
The default size is sm (36px). md is 40px, for roomier forms.
Variants
Primary is a flat neutral-100 field and is the default everywhere. Secondary is white with shadow-sm, for tinted panels.
Groups
Group options under a SelectLabel and divide groups with SelectSeparator.
Descriptions
Pass description for a supporting line under each option. The selected row shows a trailing check.
Prefix and suffix
leading places a Central Icon before the label; trailing places a count or badge before the check.
Fit content
Set fitContent on the trigger to size it to its label, for filters in a toolbar.
Long list
Cap the height with a max-h class on SelectContent; the list scrolls with a fade. Use Combobox once people need to search.
Disabled
Disable the whole Select, or a single SelectItem that is unavailable.
Error
Set aria-invalid on the trigger for a danger ring, and explain the fix with FieldError.
Best practices
When to use
- Use for one value from a short, known list (roughly 3–15 options), such as a voice, plan, or model.
- Use Combobox when people need to type to find an option, Radio when comparing a few options side by side matters, and Multi Select for more than one value.
Behavior
- Pass items ({ value, label }) to Select so the trigger shows the label, not the raw value.
- Group related options with SelectGroup and SelectLabel, and divide groups with SelectSeparator.
- Use description only when options need explaining, like “Run as: Member only”; the selected row then shows a trailing check.
- Set fitContent on SelectTrigger for toolbar filters; form fields stay full width.
- Cap long lists with a max-h class on SelectContent; the list scrolls with a fade.
Content
- Write placeholders as an action, like “Select a voice”, and option labels as nouns in sentence case.
- Use trailing for secondary facts such as a count, never for the primary label.
Accessibility
- Wrap the Select in Field with FieldLabel, or give SelectTrigger an aria-label when there is no visible label.
- Set aria-invalid on SelectTrigger and explain the fix in FieldError; do not rely on the red ring alone.