Inputs
Combobox
Select with built-in search, built for long option lists.
<script>
import { Combobox } from "@codeatlasdev/ui";
let value = $state("");
</script>
<Combobox label="Framework" options={[{ value: "svelte", label: "Svelte" }]} bind:value />
Typing in the popup filters options by label, and opening the list moves focus to the search input. Pass a label (or at least a placeholder) so the listbox has an accessible name.
Basic
Search a list of options and bind the selected value.
Code
States
Description, custom search placeholder and empty text, disabled option, error and disabled.
Astro is disabled.
Pick a framework.
Code
Props
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | '' | Bindable selected value. |
options | ComboboxOption[] | – | Options: { value, label, disabled? }. |
label | string | – | Visible label above the trigger. |
ariaLabel | string | – | Accessible name when there is no visible `label`. The trigger is named `ariaLabel` followed by its current value. Without either, it is named only by its current value. |
placeholder | string | 'Select…' (localized) | Trigger text when nothing is selected. Default comes from the active i18n catalog. |
searchPlaceholder | string | 'Search…' (localized) | Placeholder and accessible name of the search input. |
emptyText | string | 'No results' (localized) | Message shown when the filter matches nothing. |
description | string | – | Hint shown below the trigger. |
error | string | – | Error message. Puts the combobox in the error state. |
required | boolean | false | Marks the field as required. |
disabled | boolean | false | Disables the combobox. |
size | 'sm' | 'md' | 'md' | Trigger height. |
class | string | – | Extra classes on the root. |
onchange | (value: string) => void | – | Called when an option is selected. |