Skip to content

React Select Dropdown

A glass React select dropdown for picking one option, with type-to-jump and items that drift in; for search or multi-select, use the Combobox.

npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/select.json
Framework

 

  • Select
  • useVirtualWindow
  • defaultSelectLabels
  • VIRTUALIZE_THRESHOLD
  • +2 more

Using it in a form? See the react-hook-form and zod recipe.

Icons and descriptions

Framework

Files to copy

7 folders · 16 files · 4 packages
From theme/src/
  • components/select/
  • components/drawer/parts/sheet.tsx
  • components/spinner/
  • hooks/{use-controllable.ts, use-latest.ts, use-media-query.ts, use-preferences.ts, use-virtual-window.ts}
  • motion/tokens.ts
  • lib/{cn.ts, field-size.ts, form.ts, glide-highlight.tsx, group-segments.ts, page-size.ts, popup-a11y.ts, popup-motion.ts, warn-once.ts}
  • styles/
shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/select.jsonRegistry item: select. The styles need the Tailwind v4 glass UI setup.
Packages
pnpm add @base-ui/react clsx motion tailwind-merge

Grouped

Region

Where your data is stored.

Thousands of options

Above 200 options the list is windowed on its own (virtualized defaults to auto); pass virtualized to force it. Only the rows near the viewport are in the DOM, yet Home, End, PageUp, PageDown and type-ahead reach every option and screen readers still hear 'item 3,000 of 5,000'. Press End, or type 'Item 4321'.

Item

Bottom sheet on phones

mobile='sheet' opens the list as a bottom sheet under 640px wide: a drag handle you can swipe down, a scrolling body capped at 85dvh, safe-area padding and a dimmed scrim. The default, 'popup', keeps the floating list. Press “Preview on a phone” to try it on a desktop screen (or narrow the window).

Region

Props

PropTypeDefaultDescription
items (required)SelectItem[]NoneTakes the options, in display order.
valuestring | nullNoneThe selected value (controlled). null means nothing selected.
defaultValuestring | nullNoneSets the starting value when uncontrolled.
onValueChange((value: string | null) => void)NoneCalled with the new value when the person picks an option.
openbooleanNoneWhether the list is open (controlled). Pair with onOpenChange. Leave it out to let the trigger decide.
defaultOpenbooleanfalseWhether the list starts open when uncontrolled.
onOpenChange((open: boolean) => void)NoneCalled when the list opens or closes.
labelReactNodeNoneText above the trigger, linked to it as its accessible name.
descriptionReactNodeNoneMuted helper text under the trigger.
errorReactNodeNoneError message under the trigger. Marks the select invalid and is announced.
placeholderReactNodelabels.placeholder ("Select…")Shown in the trigger while nothing is selected, as a node.
labelsPartial<SelectLabels>defaultSelectLabelsEvery string, for translation: the placeholder and the heading of ungrouped items. Every other string, for translation: labels={{ placeholder: "…" }}; omitted keys keep the English of defaultSelectLabels. All 3 keys of SelectLabels are listed in the key table under the props table.
idstringgeneratedId of the trigger button; a generated one is used when omitted.
namestringNoneSubmits the value with a form.
requiredbooleanNoneMarks the field as required for form validation.
disabledbooleanNoneDisables the select and its popup.
sizeFieldSize"md"Height, consistent across every form control: "sm" 32px, "md" 40px, "lg" 48px (sm and md are 44px on touch screens), the same scale as Button.
loadingbooleanfalseThe options are on their way: the trigger shows a spinner and is marked busy (aria-busy). Keep passing the items you have.
readOnlybooleanNoneShow the value but do not allow changes.
aria-labelstringNoneAccessible name when there is no visible label.
aria-labelledbystringNoneId of an element that names the select.
aria-describedbystringNoneId of extra help text; joined with the description and error ids.
aria-invalidboolean | "true" | "false"NoneMarks the select invalid without an error message.
onBlurFocusEventHandler<HTMLButtonElement>NoneCalled when the trigger loses focus (react-hook-form: marks the field touched).
classNamestringNoneClass for the outer wrapper (label + trigger + helper text), same as Input and Combobox.
triggerClassNamestringNoneClass for the trigger button.
virtualizedboolean | "auto""auto"Windows the list so only the options near the viewport are in the DOM: true always, false never, "auto" only above 200 options (VIRTUALIZE_THRESHOLD). Arrow keys, Home / End, PageUp / PageDown and type-ahead still reach every option, aria-setsize / aria-posinset keep the count for screen readers, and the scroll height does not change. Windowed rows are a fixed height (one line; a description is cut to fit) and group headings are visual only.
mobileMobilePresentation"popup"How the list opens on a phone-width screen (max-width: 640px): "popup" is the usual floating list; "sheet" is a bottom sheet with a drag handle, swipe-down to dismiss, a scrollable body capped at 85 dvh, home-indicator padding and a dimmed scrim. Focus is trapped and returned and Escape closes in both.
SelectLabels keys and English defaults (3)
Pass any key in labels; the rest keep the defaults of defaultSelectLabels.
KeyEnglish default
placeholderSelect…
otherGroupOther
closeClose

Keyboard

KeysAction
Enter/Space/Arrow DownOpen the list from the trigger.
Arrow Down/Arrow UpMove through the options.
Home/EndJump to the first or last option.
Type a letterJump to the next option that starts with it.
Enter/SpacePick the highlighted option.
EscapeClose the list and return focus to the trigger.

Accessibility

  • A Base UI Select: the trigger is a combobox-style button with aria-expanded, the popup a listbox of options.
  • label, description and error are linked to the trigger; the error is announced politely.
  • name submits the value with a form. Pass aria-label when there is no visible label.

All exports on this page

  • Select — A glass select: opens below the trigger, supports groups, icons and descriptions, and you can type to jump to an option.
  • VIRTUALIZE_THRESHOLD — Lists longer than this are windowed on their own (virtualized="auto"): Select, Combobox and CommandPalette.
  • defaultSelectLabels — The English SelectLabels used when labels is omitted; a partial labels prop is merged over it.
  • useVirtualWindow — A small windowing hook for long lists of equally tall rows.

When to use Select

  • Use Select as a glass select for a short, fixed list like a sort order, a time zone preset or a billing plan, where people pick one value and the options fit in one popup. Use it as a custom select in Tailwind projects when the native dropdown cannot be styled to match the rest of the page.
  • Use group, icon and description on items for a language or workspace picker, where headings, flags or a second line help people choose the right entry.
  • Use error, required and name for a field inside a form, with the value submitted natively and the message linked to the trigger for screen readers.
  • Skip it when the list is long enough that people want to type to find an item, or when several values can be picked. Combobox handles both, and RadioGroup suits two or three visible choices.
  • Pair it with Input and Combobox in the same form, which share the className wrapper convention, and Field or react-hook-form through ref, onBlur and name.

Frequently asked questions

67 components pages in all: browse them on All components.

By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .