Patch UI

Select

A dropdown selection component with support for grouped items, separators, and multiple sizes. Built on top of Base UI's Select primitive.

$npx shadcn add @patchui/select

Basic

Grouped

Sizes

Disabled Item

Usage

import {
  Select,
  SelectTrigger,
  SelectValue,
  SelectPopup,
  SelectItem,
  SelectGroup,
  SelectGroupLabel,
  SelectSeparator,
} from "@patchui/react";
 
// Basic select
<Select defaultValue="apple">
  <SelectTrigger>
    <SelectValue placeholder="Choose a fruit…" />
  </SelectTrigger>
  <SelectPopup>
    <SelectItem value="apple">Apple</SelectItem>
    <SelectItem value="banana">Banana</SelectItem>
    <SelectItem value="cherry">Cherry</SelectItem>
  </SelectPopup>
</Select>
 
// Grouped items
<Select defaultValue="react">
  <SelectTrigger className="w-56">
    <SelectValue placeholder="Choose a framework…" />
  </SelectTrigger>
  <SelectPopup>
    <SelectGroup>
      <SelectGroupLabel>Frontend</SelectGroupLabel>
      <SelectItem value="react">React</SelectItem>
      <SelectItem value="vue">Vue</SelectItem>
    </SelectGroup>
    <SelectSeparator />
    <SelectGroup>
      <SelectGroupLabel>Backend</SelectGroupLabel>
      <SelectItem value="node">Node.js</SelectItem>
    </SelectGroup>
  </SelectPopup>
</Select>

Props

SelectTrigger

PropTypeDefaultDescription
size"sm" | "md" | "lg""md"The size of the trigger button.
classNamestring-Additional CSS classes.

SelectValue

PropTypeDefaultDescription
placeholderstring-Text shown when no value is selected.
classNamestring-Additional CSS classes.

SelectPopup

PropTypeDefaultDescription
side"top" | "bottom" | "left" | "right""bottom"Which side of the trigger the popup appears on.
sideOffsetnumber4Distance in pixels between the popup and trigger.
align"start" | "center" | "end""start"Alignment of the popup relative to the trigger.
alignOffsetnumber0Offset for alignment in pixels.
alignItemWithTriggerbooleantrueWhether to align the selected item with the trigger.

SelectItem

PropTypeDefaultDescription
valuestring-The value of this option, used for form submission and selection state.
disabledbooleanfalseWhether this item is disabled.
classNamestring-Additional CSS classes.

Compound Components

ComponentDescription
SelectRoot component that manages open/close state and value.
SelectTriggerStyled trigger button with size variants and chevron icon.
SelectValueDisplays the selected value text inside the trigger.
SelectPopupPortal-rendered popup with positioner. Also exported as SelectContent.
SelectItemAn individual option with check indicator.
SelectGroupGroups related items together.
SelectGroupLabelLabel for a group of items.
SelectSeparatorA visual separator between items or groups.

Notes

  • Portal rendering: The popup renders via a portal, so it appears above all other content regardless of overflow or stacking context.
  • Composition: Use SelectTrigger + SelectValue for the trigger. SelectTrigger renders the styled button with a chevron icon, and SelectValue displays the currently selected item text.
  • Keyboard navigation: Supports arrow keys, type-ahead search, Home/End, and Enter/Space for selection.