Skip to content

Select

Status: stableAccessibility reviewedtenet-ui@0.4.0
Import
import { Select } from 'tenet-ui';

Also accepts every prop of Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'value' | 'defaultValue'>.

Source: src/components/Select/Select.tsx

When to use: choosing one option from a known list. Select is a fully accessible listbox combobox (keyboard, typeahead, aria-activedescendant) — not a native <select>. Use it inside a FormControl.

  • Give it an accessible name via FormControl.Label or aria-label.
  • Pass choices as the options array ({ value, label, disabled? }); use placeholder for the unselected state.
  • Control it with value + onChange(value), or leave uncontrolled with defaultValue. For form submission, pass name (it emits a hidden input).
  • Use size / fullWidth from the scale (block is the deprecated 0.3.0 name and warns); use invalid for validation state.
  • Never build a div-based dropdown by hand — getting the ARIA listbox + keyboard right is exactly what this component does for you.
  • <Select options={[{ value: 'public', label: 'Public' }]} placeholder="Choose…" />
  • ✅ inside a form: <FormControl><FormControl.Label>Visibility</FormControl.Label><Select options={…} /></FormControl>
  • <div className="dropdown" onClick={…}> — not keyboard-accessible, no roles, no typeahead.

See also: Menu for actions, RadioGroup or SegmentedControl for a few visible options; system guideline forms.

3 stories for Select — open in Storybook

The full matrix (all args, controls, accessibility panel) is in Storybook.

PropTypeDefaultDescription
options *SelectOption[]The options to choose from.
valuestringControlled selected value.
defaultValuestringUncontrolled initial value.
onChange(value: string) => voidCalled with the newly selected value.
placeholderstringSelect…Text shown when nothing is selected.
size'small' | 'medium' | 'large'
SelectSize
mediumControl height / font scale.
fullWidthbooleanStretch to fill the available width.
blockdeprecatedbooleanStretch to fill the available width.
Deprecated since 0.4.0. Use fullWidth instead (renamed in 0.4.0). block keeps working until 0.5.0.
invalidbooleanfalseInvalid state (danger border + aria-invalid).
disabledbooleanfalseDisable the control.
requiredbooleanfalseRequired (sets aria-required; pairs with FormControl).
namestringForm field name — emits a hidden input so the value submits with a form.
idstringId applied to the trigger (FormControl sets this automatically).
classNamestring
aria-labelstring
aria-describedbystring

* requiredDeprecated props keep working for one minor release; the replacement is named in the row.

SelectOption

MemberTypeDefaultDescription
value *stringValue submitted / reported on change.
label *stringVisible option text.
disabledbooleanDisable this option.