Select
Picks one value from a list, with a label, a hint and an error like any field.
Everyone on the project sees it.
Installation
npm i @uisatin/uiimport { Select } from '@uisatin/ui/select'About 46.5 kB of JavaScript, minified and gzipped, with what it imports (React aside). The stylesheet is one file for every component.
npx shadcn@latest add https://uisatin.dev/r/select.jsonAdds select.tsx, dropdown.tsx, form-field.tsx, kbd.tsx, labels.tsx and pointer-modality.tsx to components/ui and installs radix-ui.
First time with Satin? Set it up once, styles and fonts included, with the installation guide.
API Reference
The Select component wraps the Radix select in a div with a label, a trigger button and a hint. Its list is the Dropdown menu, so each option takes an icon, a description and a shortcut, in groups or not.
| Prop | Type | Default |
|---|---|---|
options | SelectOption[]SelectGroup[] | — |
value | string | — |
defaultValue | string | — |
onValueChange | (value: string) => void | — |
label | ReactNode | — |
hint | ReactNode | — |
error | ReactNodeboolean | — |
leadingIcon | ReactNode | — |
size | "sm""md""lg" | "md" |
layout | "inline""stacked" | "inline" |
iconSize | 1620 | 16 |
placeholder | string | — |
disabled | boolean | false |
name | string | — |
required | boolean | false |
open | boolean | — |
defaultOpen | boolean | false |
onOpenChange | (open: boolean) => void | — |
menuAlign | "start""end" | "start" |
className | string | — |
ref | Ref<HTMLElement> | — |
...props | ComponentProps<typeof Select.Trigger>Other attributes go to the Radix Select.Trigger part | — |
Accessibility
A Radix select. The trigger is a button with role="combobox", aria-expanded and aria-controls, named by label (or aria-label) and described by the hint or error (aria-describedby, aria-invalid). The list is a listbox of options, with group labels; the current one shows a check and adds "(selected)" for screen readers. Closing returns focus to the trigger. Inside a form, a hidden native select carries the value.
| Key | Action |
|---|---|
| EnterorSpaceor↑or↓ | On the trigger: opens the list on the current option. |
| A–Z | On the closed trigger: picks the next option whose label starts with the typed letters. In the list: moves to it. |
| ↑or↓ | Moves between options. |
| HomeorEnd | Moves to the first or last option. |
| EnterorSpace | Picks the focused option and closes the list. |
| Esc | Closes the list without picking. |
Something wrong or missing on this page?
Report a problemSuggest an improvement