Select

Basic

Grouped

Small

Searchable

Custom Items

Uses renderItem to add colored dots.

Rich Items (Cars)

Each row shows drivetrain and horsepower. The trigger displays only the car name.

Last Selected

Select a value, close, then reopen — the last pick is shown at the bottom.

Last Selected (Custom)

Same feature with a custom footer via renderLastSelected.

Loading

Disabled

Select

A select dropdown built on Radix UI Select. Supports groups, labels, separators, disabled states, and two trigger sizes.

Usage

import {
  Select,
  SelectContent,
  SelectGroup,
  SelectItem,
  SelectLabel,
  SelectSeparator,
  SelectTrigger,
  SelectValue,
} from "@/components/ui/select"

<Select value={value} onValueChange={setValue}>
  <SelectTrigger className="w-50">
    <SelectValue placeholder="Pick one" />
  </SelectTrigger>
  <SelectContent>
    <SelectItem value="apple">Apple</SelectItem>
    <SelectItem value="banana">Banana</SelectItem>
  </SelectContent>
</Select>

Select (root) props

PropTypeDefaultDescription
valuestringControlled selected value.
defaultValuestringUncontrolled default value.
onValueChange(value: string) => voidCallback when the selected value changes.
renderItem(entry: { value: string; label: string }) => ReactNodeCustom render function for each SelectItem's content. Receives the item's value and label. The return replaces the default text inside the item row — selection indicator and focus styles are preserved.
disabledbooleanfalseDisables the entire select.
openbooleanControlled open state of the dropdown.
onOpenChange(open: boolean) => voidCallback when the open state changes.
selectIdstringUnique identifier for the select instance. Used as the cookie key for persisting the last selected value.
enableLastSelectedbooleanfalseWhen true (and selectId is set), persists the last selected value in a cookie and shows a suggestion footer in the dropdown.
renderLastSelected(entry: { value: string; label: string }) => ReactNodeCustom render function for the last-selected footer content. Receives the saved entry. The return value is placed inside the footer button — you provide the inner content, the component handles the click behavior.

SelectTrigger props

PropTypeDefaultDescription
size"sm" | "default""default"Trigger height. sm = 32px, default = 36px.
loadingbooleanfalseShows a skeleton shimmer overlay and disables the trigger. Useful while data is being fetched.
classNamestringAdditional CSS classes.

SelectValue props

PropTypeDefaultDescription
placeholderstringText shown when no value is selected.

SelectItem props

PropTypeDefaultDescription
value*stringThe value for this option.
searchValuestringCustom string to match against when filtering. Defaults to children text or value.
disabledbooleanfalseDisables this individual item.
classNamestringAdditional CSS classes.

SelectContent props

PropTypeDefaultDescription
searchablebooleanfalseRenders a search input at the top of the dropdown to filter items. Forces popper positioning.
searchPlaceholderstring"Search..."Placeholder text for the search input. Only used when searchable is true.
position"item-aligned" | "popper""item-aligned"Positioning strategy for the dropdown. Forced to popper when searchable.
align"start" | "center" | "end""center"Alignment of the content relative to the trigger.
classNamestringAdditional CSS classes.