Skip to main content
Tw Twintrinsic
  • Getting Started
  • Components
  • Theming
  • Completion
Examples
Data Dashboard Game Map
Core
App
Layout
Accordion AccordionItem Card Container Panel Separator Sidebar Splitter
Navigation
AppHeader BottomBar Breadcrumb BreadcrumbItem Menu MenuItem Tabs Tab TabList TabPanel TreeMenu
Data Display
Avatar AvatarGroup Badge Carousel CarouselItem Chip ChipGroup CodeBlock CodeBlockSpeed CodeEditor DataTable Map Progress Skeleton Table TableBody TableCell TableHead TableHeader TableRow Tag TagGroup Timeline TimelineItem Tooltip Tree TreeNode
Metrics
DonutChart PieChart LineChart BarChart HorizontalBarChart AreaChart StatsCard MetricGrid KPICard GaugeChart ProgressMetric MetricTrend
Form
AutoComplete Button ButtonGroup Calendar Checkbox ColorPicker Combobox Dropdown FileUpload FloatLabel Form FormField Input InputSwitch InvalidState Knob ListInput Listbox NumberInput Radio RadioGroup Rating Select SelectGroup Slider Switch TextInput Textarea
Feedback
Modal Stepper StepperStep Toast
Utility
Icon Lazy LazyPanel Masonry ThemeToggle

Select

The Select component provides a dropdown interface for selecting one or multiple options from a list. It supports option groups, search functionality, and keyboard navigation.

Examples

Basic Usage

<Select
  label="Country"
  options={[
    { value: 'us', label: 'United States' },
    { value: 'ca', label: 'Canada' },
    { value: 'mx', label: 'Mexico' }
  ]}
  placeholder="Select a country..."
/>

Multiple Selection

<Select
  label="Programming Languages"
  options={languages}
  multiple={true}
  placeholder="Select languages..."
/>

Option Groups

<Select
  label="Programming Language"
  options={[
    {
      group: 'Frontend',
      value: 'js',
      label: 'JavaScript'
    },
    {
      group: 'Backend',
      value: 'python',
      label: 'Python'
    }
  ]}
  placeholder="Select a language..."
/>

Required Field

<Select
  label="Country"
  options={countries}
  required={true}
  placeholder="Select a country..."
/>

With Error

Please select a country
<Select
  label="Country"
  options={countries}
  error="Please select a country"
  required={true}
/>

Disabled State

<Select
  label="Country"
  options={countries}
  value="us"
  disabled={true}
/>

Props

PropTypeDefaultDescription
labelstring''Input label
optionsArray<{ value: string, label: string, group?: string }>[]Options to display in the dropdown
valuestring | string[]''Selected value(s)
multiplebooleanfalseWhether multiple selection is allowed
placeholderstring'Select...'Placeholder text when no option is selected
disabledbooleanfalseWhether the select is disabled
errorstring''Error message
requiredbooleanfalseWhether the field is required
classstring''Additional CSS classes

Events

EventDetail TypeDescription
onchange{ value: string | string[] }Fired when selection changes

Accessibility

The Select component follows WAI-ARIA guidelines for comboboxes and listboxes:

  • Proper ARIA roles and attributes for combobox and listbox
  • Support for required fields with visual and ARIA indicators
  • Error messages are linked using aria-describedby
  • Invalid states are indicated with aria-invalid
  • Proper focus management and keyboard interaction
  • Support for screen readers with ARIA labels
  • Clear visual feedback for selected and focused options

Keyboard Interaction

  • Enter or Space - Open/close dropdown and select focused option
  • Arrow Up/Down - Navigate through options
  • Tab - Move focus to next control
  • Escape - Close dropdown
  • Type - Search through options (when dropdown is open)