Tuimorphic

Select

Terminal-style dropdown select component for choosing from a list of options.

Import

import { Select } from 'tuimorphic';

Basic Usage

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

Props

PropTypeDefaultDescription
options*SelectOption[]Array of options to display
valuestringSelected value (controlled)
defaultValuestringDefault selected value (uncontrolled)
onValueChange(value: string) => voidCallback when value changes
placeholderstring'Select...'Placeholder text
labelstringLabel text
disabledbooleanfalseWhether the select is disabled
namestringName attribute for forms
classNamestringAdditional CSS class names

SelectOption Type

interface SelectOption {
  value: string;
  label: string;
  disabled?: boolean;
}

With Label

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

Disabled State

Country (Disabled)
<Select
  label="Country (Disabled)"
  placeholder="Select a country"
  options={countries}
  disabled
/>

Disabled Options

Individual options can be disabled:

<Select
  label="Select Plan"
  placeholder="Choose a plan"
  options={[
    { value: 'free', label: 'Free Plan' },
    { value: 'basic', label: 'Basic Plan' },
    { value: 'pro', label: 'Pro Plan', disabled: true },
    { value: 'enterprise', label: 'Enterprise Plan', disabled: true },
  ]}
/>

Controlled Select

Favorite Country
Selected: (none)
const [value, setValue] = useState('');
 
<Select
  label="Country"
  placeholder="Select a country"
  options={countries}
  value={value}
  onValueChange={setValue}
/>

Features

  • Built on Base UI's accessible select primitive
  • Keyboard navigation (Arrow keys, Enter, Escape)
  • Supports disabled state and disabled options
  • Works as controlled or uncontrolled component

Keyboard Navigation

KeyAction
Space / EnterOpen dropdown / select highlighted option
Arrow DownHighlight next option
Arrow UpHighlight previous option
EscapeClose dropdown
HomeHighlight first option
EndHighlight last option

Accessibility

  • Built on accessible Base UI primitives
  • Proper ARIA attributes for screen readers
  • Keyboard navigable
  • Focus management

Styling

VariableDescription
--theme-borderSelect border color
--theme-backgroundSelect background
--theme-textSelect text color
--theme-buttonOption hover background

On this page