Combobox
Searchable select
A text field that searches a list as you type. It is the right control if a BlessSelect has more options than a person can scan. multiple turns picks into removable chips. creatable lets the user add an option that is not there yet and emits create, so you can persist it.
For a handful of options use BlessSelect (native, no JS). For commands rather than values, use BlessCommand.
Filtering is client-side over options. For server-side search, listen to search (the query as typed) and bind options to what comes back: the list re-renders, nothing else changes. Keyboard: ↑ / ↓ move, Enter picks (or creates), Esc closes, and in multiple mode Backspace on an empty query removes the last chip. Inside a BlessField the field's label names the input. label is for a combobox with no visible label.
Not inside <p>
The floating panel is a <div>. HTML closes a <p> at a <div>. For this reason, a trigger placed inside a paragraph renders differently on the server and the client. Wrap it in a <span> or <div> instead.
Usage
import { BlessCombobox } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
id | string | — | |
options* | BlessOption<T>[] | — | |
placeholder | string | — | |
multiple | boolean | — | |
creatable | boolean | — | allow creating a new option from the query; emits `create` |
disabled | boolean | — | |
invalid | boolean | — | |
emptyText | string | "No results." | |
size | "md" | "sm" | "lg" | "md" | |
label | string | — | accessible name when there is no <label for> |
labels | Partial<{ remove: (name: string) => string; }> | — | |
modelValue | T | T[] | — |
Events
| Name | Payload | Description |
|---|---|---|
search | [query: string] | |
create | [label: string] | |
update:modelValue | [value: T | T[] | undefined] |
Slots
| Name | Scope | Description |
|---|---|---|
option | { option: BlessOption<T>; } |