Unkey
Components

Select

A customizable select component built with Radix UI

The Select component is a customizable dropdown menu built on top of Radix UI's Select primitive. It provides a flexible and accessible way to create select inputs with various styling options.

Features

  • Multiple variants (default, success, warning, error)
  • Left icon support
  • Fully accessible
  • Customizable styling
  • Animated transitions
  • Keyboard navigation

Variants

The Select component supports four variants:

  • default: Standard select with gray styling
  • success: Green styling for successful states
  • warning: Yellow styling for warning states
  • error: Red styling for error states

Usage

Basic Select

Select with Left Icon

Select with Groups

Disabled Select

Variant Styles

Props

SelectTrigger

PropTypeDescription
variant"default" | "success" | "warning" | "error"The visual variant of the select
leftIconReact.ReactNodeOptional icon to display on the left side
wrapperClassNamestringAdditional classes for the wrapper element
classNamestringAdditional classes for the trigger element

SelectContent

PropTypeDescription
position"popper" | "item-aligned"The positioning strategy for the dropdown
classNamestringAdditional classes for the content element

SelectItem

PropTypeDescription
valuestringThe value of the select item
disabledbooleanWhether the item is disabled
classNamestringAdditional classes for the item element

Accessibility

The Select component is built with accessibility in mind:

  • Keyboard navigation support
  • ARIA attributes
  • Focus management
  • Screen reader support
  • Proper role attributes

Best Practices

  1. Always provide a placeholder or default value
  2. Use appropriate variants for different states
  3. Group related options using SelectGroup
  4. Add icons when they provide additional context
  5. Use disabled state for unavailable options

On this page