Shadcn UI Components

Select

A select component that displays a list of options for the user to pick from. Built on Radix UI Select with full keyboard navigation.


Select Examples

Basic Select

Select with Label

Grouped Select

Scrollable Select

Installation

# The component is already installed at:
# src/components/ui/shadcn/select.tsx

Usage

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

export function SelectDemo() {
  return (
    <Select>
      <SelectTrigger className="w-[180px]">
        <SelectValue placeholder="Select a fruit" />
      </SelectTrigger>
      <SelectContent>
        <SelectItem value="apple">Apple</SelectItem>
        <SelectItem value="banana">Banana</SelectItem>
        <SelectItem value="orange">Orange</SelectItem>
      </SelectContent>
    </Select>
  )
}

Components

ComponentDescription
SelectThe root component
SelectTriggerThe button that opens the dropdown
SelectValueDisplays the selected value
SelectContentThe dropdown content container
SelectItemAn individual option
SelectGroupGroups related options
SelectLabelLabel for a group of options
Previous
Scroll Area