Combobox
A select with a text filter. Multi-select is a mode of it.

Needs Alpine. See getting started.
Use it
<x-ds::combobox
name="country"
label="Country"
:options="$countries"
:value="old('country', $user->country)"
/>
Pick several by adding :multiple="true" — chosen values become removable chips
inside the field:
<x-ds::combobox name="tags" label="Tags" :options="$tags" :value="$selected" :multiple="true" />
{{-- posts tags[]=a11y&tags[]=billing --}}
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
name | string | required | Submitted field name. [] is appended for you when multiple. |
options | array | [] | value => label. The whole list — filtering is client-side. |
value | string|array | — | Selected value, or an array of them. |
label | string | — | Field label. |
multiple | bool | false | Pick several. |
placeholder | string | Search… | |
emptyText | string | No matches | Shown when the filter matches nothing. |
help | string | — | |
error | string | — | |
disabled | bool | false |
wire:model and x-model bind the value both ways: a string, or with
multiple an array of strings. They go on the component's root, tied to the
filter field by x-modelable.
<x-ds::combobox name="owner" label="Owner" :options="$people" wire:model.live="owner" />
The combobox's own scope has open, query, selected, multiple,
options and dsValue: an x-model on a host property with one of those
names would read the combobox's instead. Rename the host's.
Without the script
Without Alpine the filter field is not drawn; a native select of the same
options takes its place, posting the same name (name[] with multiple, a
list box), so what the reader chooses is what posts. Alpine disables and hides
it, and shows the filter field.
Which control
| Options | Reach for |
|---|---|
| under ~15, one choice | select |
| under ~12, several choices | a list of checkboxes — more scannable, and free |
| more than that, or unfamiliar values | this |
A combobox costs the reader a decision before they can act: they have to guess
what to type. Below about fifteen options a plain list is faster, and on a phone
the native <select> is faster still.
Filtering is client-side
You pass the whole list and the browser filters it. There is no server-side search — that needs a request, and a request needs a backend contract this system deliberately doesn't have.
For a list too large to send down, you want a different component than this one.
Where the list opens
Below the field, at its width. With the package's
script on the page, it flips above
the field when there is no room below, and it is placed with
position: fixed, so a card, a table or a modal body that scrolls cannot
clip it; it follows the field as that body scrolls. With room it opens exactly
where it always did.
Without the script it still works, below the field as before 2.0, and a clipping ancestor cuts it off.
Keyboard
Typing filters. Arrows walk the filtered list, Home and End jump, Enter and Space choose, Escape closes.
Backspace on an empty query removes the last chip — without it, undoing a selection means aiming at a 12px ✕, which on a touch screen isn't a target.
With validation
<x-ds::combobox
name="country"
label="Country"
:options="$countries"
:value="old('country')"
:error="$errors->first('country')"
help="Where the invoice is issued from."
/>
Don't
- Don't use it under fifteen options. See the table above.
- Don't use it for actions. A menu of verbs is a dropdown.
- Don't expect server-side filtering.
- Don't use
multiplewhere the total is unbounded. Twenty chips wrap the field to four lines and shove the page around.
More in specs/combobox.md.
From the package repo: edit this page on GitHub.