Select
Dropdown select form control styled classless via the native <select> element. Uses a CSS background-image chevron, preserves native semantics and keyboard behavior, and supports option groups, multiple selection, disabled, and validation states.
Usage
When to use
- Choosing a single option from a short-to-medium list of mutually exclusive values
- Grouping related options via
<optgroup> - Allowing multiple selection with
<select multiple>
When not to use
- Fewer than three options - use radio buttons
- Options with rich content (icons, descriptions) - use a custom combobox component
- Free-text entry - use an input with datalist instead
Do
- Associate a
<label>with the select viafor/id - Use
<optgroup label="...">for grouping related options - Set
aria-invalid="true"for validation errors
Don't
- Build a custom dropdown - Semetrika ships only the native control
- Omit the label or rely on placeholder text alone
API
Slots
| Slot | Required | Description |
|---|---|---|
label | Yes | Visible label text for the select. |
Props
| Prop | Type | Default | Description |
|---|---|---|---|
options | array | - | Array of option or optgroup objects. Options have text, value, is_selected, is_disabled fields. Optgroups have type "optgroup", label, and a nested options array. |
name | string | - | Name attribute for the select element. |
id | string | - | Associates the control with its label. Auto-generated when omitted. |
is_multiple | boolean | - | Allows multiple simultaneous selection. |
rows | number | - | Number of visible rows for multi-select (maps to the size HTML attribute). |
is_disabled | boolean | - | Disables the control. |
is_required | boolean | - | Marks the control as required. |
is_invalid | boolean | - | Marks the control as invalid. Renders aria-invalid="true" when set. |
classes | array | - | Additional CSS class words merged into the root element. |
attributes | object | - | Additional HTML attributes spread on the root element. |
Classes
| Class | Capability | Default | Description |
|---|---|---|---|
.sm | Size | - | Small. |
.md | Size | Yes | Medium. |
.lg | Size | - | Large. |
Examples
Sizes
Sm, default, and lg variants stacked vertically. Font size, padding, and chevron all scale together.
Default
Single-selection select with placeholder and a handful of options.
Grouped
Select with <optgroup> grouping related options.
Multiple
<select multiple> allowing multiple value selection.
Invalid
Validation error state via aria-invalid="true".
Disabled
Disabled select via the disabled attribute.
Multiple grouped
The two previous variants combined, a multi-select whose options are divided into <optgroup> sections.
Accessibility
- WCAG 2.2 AA
- Native
<select>semantics preserved (no custom dropdown) <optgroup>useslabelattribute for screen readersaria-invalidreflects validation state- Visible focus ring via
:focus-visible - Keyboard support comes from the native control (Up/Down, Home, End, typeahead, Space/Enter to open)
Dependencies
- textfield - shared visual tokens (background, border, focus, placeholder)
Related
- textfield - shares input tokens