Inputs
Select
Dropdown selector with keyboard navigation, a label, hint and error state.
<script>
import { Select } from "@codeatlasdev/ui";
let value = $state("br");
</script>
<Select label="Country" options={[{ value: "br", label: "Brazil" }]} bind:value />
For long lists that need filtering, use Combobox. Without a label, pass aria-label (or aria-labelledby) to name the trigger: the accessible name is that text followed by the current value, so it still contains the visible text. With neither, the placeholder names it. Arrow keys, Enter and Space open the list from the trigger, and Escape closes it. Pass name to submit the selected value with a native form (a hidden input; nothing is sent while no option is selected or the field is disabled). required blocks native form submission while nothing is selected. Text inside inputs stays at 16px or more on touch screens, so iOS Safari never zooms on focus.
Basic
Controlled select with a pre-selected value.
Selected: svelte
Reference #040 · Pick in the gallery
Code
Placeholder
No initial value: the placeholder shows until the user picks an option.
Reference #042 · Pick in the gallery
Code
Empty-value option
An option with value '' (such as 'All projects') is a real selection: the trigger shows its label, not the placeholder. Use it for filters instead of a sentinel value.
Filter value: ""
Reference #041 · Pick in the gallery
Code
States
Disabled options, description, error and a disabled select.
Enterprise is disabled.
Pick a region to continue.
Reference #043 · Pick in the gallery
Code
Props
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | – | Bindable selected value. `undefined` means no selection and shows the placeholder; `""` is a valid value when an option declares it. |
options | Array<{ value: string; label: string; disabled?: boolean }> | – | Option items. |
placeholder | string | 'Select…' (localized) | Text shown when `value` is `undefined` or matches no option. The default comes from the active i18n catalog. |
label | string | – | Visible label above the trigger. |
description | string | – | Hint shown below the trigger. |
aria-label | string | – | Accessible name when there is no visible `label`. The trigger is named `aria-label` + current value; the list is named `aria-label`. |
aria-labelledby | string | – | Id of an element that names the select when there is no visible `label` (followed by the current value). Ignored when `label` is set. |
error | string | – | Error message. Puts the select in the error state. |
name | string | – | Native name, so the selected value is in FormData on a plain form submit. |
required | boolean | false | Marks the field as required. |
disabled | boolean | false | Disables the entire select. |
size | 'sm' | 'md' | 'md' | Trigger height. |
class | string | – | Extra classes on the root. |
onchange | (value: string) => void | – | Called when the selection changes. |