Search

Search documentation

Select

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

Installation

pnpm dlx shadcn@latest add @evolphin/select

Usage

import {
  Select,
  SelectContent,
  SelectItem,
  SelectTrigger,
  SelectValue,
} from "@/components/ui/select";
<Select>
  <SelectTrigger className="w-[180px]">
    <SelectValue placeholder="Theme" />
  </SelectTrigger>
  <SelectContent>
    <SelectItem value="light">Light</SelectItem>
    <SelectItem value="dark">Dark</SelectItem>
    <SelectItem value="system">System</SelectItem>
  </SelectContent>
</Select>

Type Definitions

interface SelectProps {
  /** The value of the selected item */
  value?: string;
SelectProps.value?: string | undefined

The value of the selected item

/** The default value of the selected item when uncontrolled */ ?: string; /** Event handler called when the value changes */ ?: (: string) => void; /** The open state of the select */ ?: boolean; }

Examples

Default

Scrollable

API Reference

Select

PropTypeDefaultDescription
valuestring-The controlled value of the select.
defaultValuestring-The default value of the select when uncontrolled.
onValueChange(value: string) => void-Event handler called when the value changes.
openboolean-The controlled open state of the select.
defaultOpenboolean-The default open state when uncontrolled.
onOpenChange(open: boolean) => void-Event handler called when the open state changes.

SelectTrigger

PropTypeDefaultDescription
classNamestring-Additional CSS classes

SelectValue

PropTypeDefaultDescription
placeholderstring-The placeholder text to display when no value is selected.

SelectContent

PropTypeDefaultDescription
position`"item-aligned" \"popper"`"item-aligned"
classNamestring-Additional CSS classes

SelectItem

PropTypeDefaultDescription
valuestring-The value of the item.
disabledbooleanfalseWhether the item is disabled.

SelectGroup

PropTypeDefaultDescription
classNamestring-Additional CSS classes

SelectLabel

PropTypeDefaultDescription
classNamestring-Additional CSS classes

SelectSeparator

PropTypeDefaultDescription
classNamestring-Additional CSS classes

On this page