Inputs
Combobox
Select with built-in search 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 ariaLabel) so the trigger and listbox have an accessible name. It has no name prop and does not submit with a native form (unlike Select): read value instead.
Basic
Search a list of options and bind the selected value.
Reference #010 · Pick in the gallery
Code
States
Description, custom search placeholder and empty text, disabled option, error and disabled.
Astro is disabled.
Pick a framework.
Reference #011 · Pick in the gallery
Code
Multiple selection
Set multiple and bind value to a string[]. The popup becomes a listbox with aria-multiselectable, each pick toggles its option (aria-selected) and the list stays open so you can keep picking. Selected values show as removable chips above the trigger, and the trigger shows the count. With the search input focused, Enter toggles the highlighted option and Backspace on an empty query removes the last chip.
Add creatable to offer a Create "text" row when the query matches no option exactly. Choosing it appends the text to value and calls oncreate(text): add it to options there if you want it to stay selectable. In single mode creatable sets value to the new text and closes the list.
Multiple
Searchable multi-select with removable chips and a disabled option.
Backspace on an empty search removes the last chip.
Selected: bug, ui
Reference #420 · Pick in the gallery
Code
Creatable tags
Create a tag from the search text when nothing matches.
Reference #421 · Pick in the gallery
Code
Props
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | string[] | '' (or [] when multiple) | Bindable selected value. A `string[]` when `multiple` is set. |
multiple | boolean | false | Multi-select: `value` is `string[]`, the list stays open after each pick, selections render as removable chips. |
creatable | boolean | false | Offers a `Create "query"` row when the query matches no option label exactly. |
oncreate | (value: string) => void | – | Called with the new text when the create row is chosen. |
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 | string[]) => void | – | Called when the selection changes. Receives the array when `multiple`. |