Skip to content
Logic2BUI

Search docs

Search components and documentation

New
Menu

Select

Displays a list of options for the user to pick from—triggered by a button.

Installation

npx logic2b@next add select

Usage

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

<Select>
  <SelectTrigger aria-label="Select a fruit" className="w-[180px]">
    <SelectValue placeholder="Select a fruit" />
  </SelectTrigger>
  <SelectContent>
    <SelectItem value="apple">Apple</SelectItem>
  </SelectContent>
</Select>

Examples

Grouped options

With a disabled option

Accessibility

Built on Radix Select, following the WAI-ARIA listbox pattern.

  • Fully keyboard operable: open with Enter/Space/arrow keys, move with arrows, and type-ahead to jump to an option.
  • Esc closes the list and focus returns to the trigger.
  • Give SelectTrigger an explicit accessible name with aria-label or aria-labelledby; SelectValue’s placeholder communicates the empty state but does not replace the field name.
  • Group related options with SelectGroup + SelectLabel for clearer announcements.

Live playground

Edit the component props and inspect the exact JSX before copying it. The preview loads only when this section enters the viewport.

Generated JSX
<Select
  defaultValue="team"
>
  <SelectTrigger
    className="w-56"
    aria-label="Workspace plan"
  >
    <SelectValue
      placeholder="Choose a plan"
     />
  </SelectTrigger>
  <SelectContent>
    <SelectItem
      value="starter"
    >Starter</SelectItem>
    <SelectItem
      value="team"
    >Team</SelectItem>
    <SelectItem
      value="enterprise"
    >Enterprise</SelectItem>
  </SelectContent>
</Select>

API reference

Generated from the public TypeScript exports in src/ui/select.tsx.

View JSON

Select

Component
Props: React.ComponentProps<typeof SelectPrimitive.Root>

SelectContent

Component
Props: React.ComponentProps<typeof SelectPrimitive.Content>
PropTypeRequiredDefaultDescription
position"item-aligned" | "popper"No"popper"—

SelectGroup

Component
Props: React.ComponentProps<typeof SelectPrimitive.Group>

SelectItem

Component
Props: React.ComponentProps<typeof SelectPrimitive.Item>

SelectLabel

Component
Props: React.ComponentProps<typeof SelectPrimitive.Label>

SelectScrollDownButton

Component
Props: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>

SelectScrollUpButton

Component
Props: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>

SelectSeparator

Component
Props: React.ComponentProps<typeof SelectPrimitive.Separator>

SelectTrigger

Component
Props: React.ComponentProps<typeof SelectPrimitive.Trigger> & { size?: "sm" | "default" }
PropTypeRequiredDefaultDescription
size"sm" | "default"No"default"—

SelectValue

Component
Props: React.ComponentProps<typeof SelectPrimitive.Value>

Accessibility contract

Machine-readable behavior and consumer responsibilities for select.

View JSON
Support
Primitive-managed
Pattern
listbox select
Radix Select
Keyboard interactions for select
KeysBehavior
Enter SpaceActivate the focused control.
ArrowUp ArrowDown ArrowLeft ArrowRightMove within the composite control.
Home EndMove to the first or last option.
EscapeClose the open surface and restore focus.

Built-in semantics

  • Manages combobox/listbox/option semantics, selected state and trigger-value linkage.

Consumer responsibilities

  • Provide a visible label or aria-label for the trigger.