Components
Combobox
A filterable picker over a list of options — button or inline-input trigger, single or multi-select.
<x-ui.combobox
placeholder="Select framework..."
searchPlaceholder="Search framework..."
empty="No framework found."
:options="[
['value' => 'next', 'label' => 'Next.js'],
['value' => 'sveltekit', 'label' => 'SvelteKit'],
['value' => 'nuxt', 'label' => 'Nuxt.js'],
['value' => 'remix', 'label' => 'Remix'],
['value' => 'astro', 'label' => 'Astro'],
]"
/>
Disabled
<x-ui.combobox
disabled
placeholder="Select framework..."
searchPlaceholder="Search framework..."
empty="No framework found."
:options="[
['value' => 'next', 'label' => 'Next.js'],
['value' => 'sveltekit', 'label' => 'SvelteKit'],
['value' => 'nuxt', 'label' => 'Nuxt.js'],
['value' => 'remix', 'label' => 'Remix'],
['value' => 'astro', 'label' => 'Astro'],
]"
/>
Indicators
{{-- Choose how a selected option is marked: `check` (default), `checkbox`
(pairs well with multiple) or `radio` (pairs well with single-select). --}}
<div class="flex flex-wrap items-start gap-4">
<x-ui.combobox
indicator="checkbox"
multiple
width="w-[220px]"
placeholder="Select frameworks..."
:value="['next']"
:options="[
['value' => 'next', 'label' => 'Next.js'],
['value' => 'nuxt', 'label' => 'Nuxt.js'],
['value' => 'remix', 'label' => 'Remix'],
['value' => 'astro', 'label' => 'Astro'],
]"
/>
<x-ui.combobox
indicator="radio"
width="w-[220px]"
placeholder="Select a framework..."
:value="'next'"
:options="[
['value' => 'next', 'label' => 'Next.js'],
['value' => 'nuxt', 'label' => 'Nuxt.js'],
['value' => 'remix', 'label' => 'Remix'],
['value' => 'astro', 'label' => 'Astro'],
]"
/>
</div>
Inline Addons
{{--
Addons and a card: the `start` and `end` slots put an icon and icon-only buttons inside the
field, like an input-group. `combobox-select` carries the whole option, so the page can swap
the field for a card at the moment of the pick, with no round trip. The end buttons pick
without the list: a walk-in customer, or (in a real page) one created in a dialog.
--}}
<div
x-data="{ customer: null }"
class="w-[340px]"
>
<div x-show="! customer">
<x-ui.combobox
trigger="input"
width="w-full"
placeholder="Search customer (name or ID)"
:options="[
['value' => '1', 'label' => 'Ana García', 'document' => '45744263'],
['value' => '2', 'label' => 'Luis Fernández', 'document' => '20512345678'],
['value' => '3', 'label' => 'José Ramírez', 'document' => '70011223'],
]"
x-on:combobox-select="customer = $event.detail.option"
>
<x-slot:start>
<x-lucide-search aria-hidden="true" />
</x-slot:start>
<x-slot:end>
<x-ui.input-group-button size="icon-xs" aria-label="Walk-in customer" title="Walk-in customer" x-on:click="customer = { label: 'Walk-in customer', document: null }">
<x-lucide-users aria-hidden="true" />
</x-ui.input-group-button>
<x-ui.input-group-button size="icon-xs" aria-label="New customer" title="New customer" x-on:click="customer = { label: 'New customer', document: '00000000' }">
<x-lucide-user-plus aria-hidden="true" />
</x-ui.input-group-button>
</x-slot:end>
</x-ui.combobox>
</div>
<x-ui.item x-show="customer" x-cloak variant="muted" size="sm">
<x-ui.item-media variant="icon">
<x-lucide-user aria-hidden="true" />
</x-ui.item-media>
<x-ui.item-content>
<x-ui.item-title x-text="customer?.label"></x-ui.item-title>
<x-ui.item-description x-show="customer?.document" x-text="customer?.document"></x-ui.item-description>
</x-ui.item-content>
<x-ui.item-actions>
<x-ui.button type="button" variant="ghost" size="icon-sm" aria-label="Change customer" title="Change customer" x-on:click="customer = null">
<x-lucide-x aria-hidden="true" />
</x-ui.button>
</x-ui.item-actions>
</x-ui.item>
</div>
Inline Async
{{--
Async options: with `remote`, the combobox asks for its options with a `combobox-fetch`
event while you type (debounced), and asks for the next page when the list is scrolled to
its end. Answer with `respond()`: an array, `{ options, hasMore }`, or a promise of either.
The browser does not filter what the server returned. With Livewire the handler is one line:
`$event.detail.respond($wire.search($event.detail.query, $event.detail.offset, $event.detail.limit))`.
Here a fake 350 ms fetch pages through 200 generated frameworks.
--}}
<div
x-data="{
all: Array.from({ length: 200 }, (_, i) => ({ value: 'fw-' + (i + 1), label: 'Framework ' + String(i + 1).padStart(3, '0') })),
search({ query, offset, limit }) {
const needle = query.toLowerCase();
const matches = this.all.filter((o) => o.label.toLowerCase().includes(needle));
return new Promise((resolve) => setTimeout(() => resolve({
options: matches.slice(offset, offset + limit),
hasMore: offset + limit < matches.length,
}), 350));
},
}"
class="w-[280px]"
>
<x-ui.combobox
trigger="input"
remote
:page-size="20"
width="w-full"
placeholder="Search frameworks (async)..."
x-on:combobox-fetch="$event.detail.respond(search($event.detail))"
/>
</div>
Inline Icon
{{-- The inline-input trigger accepts a leading `icon` (any lucide name) and a `size`. --}}
@php($frameworks = [
['value' => 'next', 'label' => 'Next.js'],
['value' => 'svelte', 'label' => 'SvelteKit'],
['value' => 'nuxt', 'label' => 'Nuxt'],
['value' => 'remix', 'label' => 'Remix'],
['value' => 'astro', 'label' => 'Astro'],
['value' => 'laravel', 'label' => 'Laravel'],
])
<x-ui.combobox trigger="input" icon="search" :options="$frameworks" placeholder="Search framework..." />
Inline Input
{{-- `trigger="input"` makes the field itself the search box — the inline autocomplete shape. --}}
@php($frameworks = [
['value' => 'next', 'label' => 'Next.js'],
['value' => 'svelte', 'label' => 'SvelteKit'],
['value' => 'nuxt', 'label' => 'Nuxt'],
['value' => 'remix', 'label' => 'Remix'],
['value' => 'astro', 'label' => 'Astro'],
['value' => 'laravel', 'label' => 'Laravel'],
])
<x-ui.combobox trigger="input" :options="$frameworks" placeholder="Search framework..." />
Inline Multiple
{{-- Inline-input + multiple = a tag input: picks become removable chips inside the field
and the list stays open after each pick. --}}
<x-ui.combobox
trigger="input"
multiple
width="w-[280px]"
placeholder="Search frameworks..."
:value="['next']"
:options="[
['value' => 'next', 'label' => 'Next.js'],
['value' => 'svelte', 'label' => 'SvelteKit'],
['value' => 'nuxt', 'label' => 'Nuxt'],
['value' => 'remix', 'label' => 'Remix'],
['value' => 'astro', 'label' => 'Astro'],
]"
/>
Inline Sizes
{{-- The inline-input trigger honours `size` (sm | default | lg). --}}
@php($frameworks = [
['value' => 'next', 'label' => 'Next.js'],
['value' => 'svelte', 'label' => 'SvelteKit'],
['value' => 'nuxt', 'label' => 'Nuxt'],
['value' => 'remix', 'label' => 'Remix'],
['value' => 'astro', 'label' => 'Astro'],
])
<div class="flex flex-col gap-3">
<x-ui.combobox trigger="input" :options="$frameworks" size="sm" placeholder="Small" />
<x-ui.combobox trigger="input" :options="$frameworks" size="default" placeholder="Default" />
<x-ui.combobox trigger="input" :options="$frameworks" size="lg" placeholder="Large" />
</div>
Inline With Label
{{-- An inline-input combobox wired to a label + a form field name (submits as `framework`).
`id` lands on the input itself, so the label names and focuses it. --}}
@php($frameworks = [
['value' => 'next', 'label' => 'Next.js'],
['value' => 'svelte', 'label' => 'SvelteKit'],
['value' => 'nuxt', 'label' => 'Nuxt'],
['value' => 'remix', 'label' => 'Remix'],
['value' => 'astro', 'label' => 'Astro'],
])
<div class="grid w-[260px] gap-2">
<x-ui.label for="framework">Framework</x-ui.label>
<x-ui.combobox id="framework" trigger="input" name="framework" :options="$frameworks" placeholder="Search framework..." />
</div>
Multiple
<x-ui.combobox
multiple
width="w-[260px]"
placeholder="Select frameworks..."
searchPlaceholder="Search framework..."
empty="No framework found."
:value="['next', 'remix']"
:options="[
['value' => 'next', 'label' => 'Next.js'],
['value' => 'sveltekit', 'label' => 'SvelteKit'],
['value' => 'nuxt', 'label' => 'Nuxt.js'],
['value' => 'remix', 'label' => 'Remix'],
['value' => 'astro', 'label' => 'Astro'],
]"
/>
Nested In Dialog
Assign branches
The picker teleports out of the dialog, so a long list is never clipped by it.
<x-ui.dialog>
<x-ui.dialog-trigger>
<x-ui.button variant="outline">Assign branches</x-ui.button>
</x-ui.dialog-trigger>
<x-ui.dialog-content class="sm:max-w-[425px]">
<x-ui.dialog-header>
<x-ui.dialog-title>Assign branches</x-ui.dialog-title>
<x-ui.dialog-description>
The picker teleports out of the dialog, so a long list is never clipped by it.
</x-ui.dialog-description>
</x-ui.dialog-header>
<x-ui.field>
<x-ui.field-label>Branches</x-ui.field-label>
<x-ui.combobox
multiple
indicator="checkbox"
width="w-full"
placeholder="Select branches"
:options="[
['value' => 'antwerp', 'label' => 'Antwerp'],
['value' => 'brussels', 'label' => 'Brussels'],
['value' => 'charleroi', 'label' => 'Charleroi'],
['value' => 'ghent', 'label' => 'Ghent'],
['value' => 'liege', 'label' => 'Liège'],
]"
/>
</x-ui.field>
<x-ui.dialog-footer>
<x-ui.button type="submit">Save</x-ui.button>
</x-ui.dialog-footer>
</x-ui.dialog-content>
</x-ui.dialog>
Non Searchable
{{-- A plain picker: `:searchable="false"` drops the search box. The panel matches the trigger width. --}}
<x-ui.combobox
:searchable="false"
placeholder="Select a plan…"
width="w-[220px]"
:options="[
['value' => 'free', 'label' => 'Free'],
['value' => 'pro', 'label' => 'Pro'],
['value' => 'team', 'label' => 'Team'],
['value' => 'enterprise', 'label' => 'Enterprise'],
]"
/>
Preselected
<x-ui.combobox
value="remix"
placeholder="Select framework..."
searchPlaceholder="Search framework..."
empty="No framework found."
:options="[
['value' => 'next', 'label' => 'Next.js'],
['value' => 'sveltekit', 'label' => 'SvelteKit'],
['value' => 'nuxt', 'label' => 'Nuxt.js'],
['value' => 'remix', 'label' => 'Remix'],
['value' => 'astro', 'label' => 'Astro'],
]"
/>
Statuses
<x-ui.combobox
placeholder="+ Set status"
searchPlaceholder="Change status..."
empty="No status found."
width="w-[220px]"
:options="[
['value' => 'backlog', 'label' => 'Backlog'],
['value' => 'todo', 'label' => 'Todo'],
['value' => 'in-progress', 'label' => 'In Progress'],
['value' => 'done', 'label' => 'Done'],
['value' => 'canceled', 'label' => 'Canceled'],
]"
/>
With Label
{{-- `id` lands on the trigger button, so <label for> names it and a click on the label
focuses it — the same as a native <select>. --}}
<div class="grid w-[220px] gap-2">
<x-ui.label for="category-root">Category</x-ui.label>
<x-ui.combobox
id="category-root"
name="category_root_id"
width="w-full"
:options="[
['value' => '1', 'label' => 'Clothing'],
['value' => '2', 'label' => 'Footwear'],
['value' => '3', 'label' => 'Accessories'],
]"
placeholder="Select a category"
/>
</div>
Using with Livewire
wire:model
The examples above are the frontend (Blade + Alpine) usage. Inside a Livewire component, bind
wire:model for two-way
state — same component, no wrappers.
Full Livewire guide →
use Livewire\Component;
class Demo extends Component
{
public string $framework = '';
public function render()
{
return view('livewire.demo');
}
}
<x-ui.combobox wire:model="framework" :options="['laravel' => 'Laravel', 'rails' => 'Rails']" />
API Reference
Props, slots and exposed methods for
<x-ui.combobox>.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
options* |
array
|
[]
|
The selectable options. Each entry may be a plain string (used as both value and label) or an associative array with value and label. See Each option below. |
value |
string|array
|
''
|
The initially selected value. Pass an array of values when multiple is true. |
name |
string
|
— | Form field name. A hidden input mirrors the selection so it submits with a form (as name[] when multiple). |
placeholder |
string
|
— | Trigger text shown when nothing is selected. Defaults to a translatable "Select option..." string. |
searchPlaceholder |
string
|
— | Placeholder for the search input. Defaults to a translatable "Search..." string. |
empty |
string
|
— | Message shown when the search matches no options. Defaults to a translatable "No results found." string. |
trigger |
string
|
'button'
|
How the listbox is opened. "button" is the classic popover with a search input inside. "input" makes the field itself the search box — the inline autocomplete shape (replaces the deprecated <x-ui.autocomplete>).
button
input
|
searchable |
bool
|
true
|
Show the search input (button trigger only). Set false for a plain picker that lists every option with no filtering. |
size |
string
|
'default'
|
Height and text size of the field (input trigger, single-select).
sm
default
lg
|
icon |
string
|
— | Optional leading Lucide icon name, e.g. "search" (input trigger only). |
multiple |
bool
|
false
|
Allow picking many values. Selected items render as removable chips and the list stays open after each pick. |
indicator |
string
|
'check'
|
How a selected option is marked in the list: a trailing check, a checkbox box (pairs well with multiple), or a radio dot (pairs well with single-select).
check
checkbox
radio
|
disabled |
bool
|
false
|
Disables the trigger so the list cannot be opened. |
width |
string
|
'w-[200px]'
|
Tailwind width class for the trigger; the popover matches the trigger's width. |
id |
string
|
— | Set on the focusable control: the trigger button, or the text field with trigger="input". A <label for="{id}"> then names it and focuses it on click, as with a native select. The search field inside the popover gets {id}-search. |
remote |
bool
|
false
|
Since 1.39. The options come from the server, a page at a time, through the combobox-fetch event: while the user types (debounced), when the list opens on a query it has not fetched yet, and when the list is scrolled near its end. The browser stops filtering, since the server already did. Enter pressed before the answer arrives waits for it, and picks the only match if there is exactly one (a barcode scanner). |
pageSize |
int
|
30
|
Since 1.39. With remote: how many options to ask for per page, sent as detail.limit. |
debounce |
int
|
250
|
Since 1.39. With remote: milliseconds of quiet typing before a search is sent. |
* Required.
Each option
| Prop | Type | Default | Description |
|---|---|---|---|
value* |
string
|
— | The submitted value for this option. |
label |
string
|
— | Visible, searchable text for the option. Falls back to value when omitted. |
… |
mixed
|
— | Any other key is kept on the option and travels with combobox-select. |
Slots
| Slot | Description |
|---|---|
start |
Since 1.39. Input trigger, single select: content inside the field before the text, like an input-group addon (a search icon). Replaces the icon prop. |
end |
Since 1.39. Input trigger, single select: content inside the field after the text, in place of the chevron. Icon-only <x-ui.input-group-button>s fit here; clicking them does not open the list. |
Events
Events the component listens for (in) and dispatches (out). Both directions bubble,
so .window works
even when the component is teleported.
| Event | Direction | Detail |
|---|---|---|
combobox-fetch |
Out |
{ query, offset, limit, respond }
Since 1.39, with remote. Asks for options. offset 0 is a new search and replaces the list; a higher offset is the next page and is appended. Call respond() with an array of options, with { options, hasMore }, or with a promise of either: x-on:combobox-fetch="$event.detail.respond($wire.searchCustomers($event.detail.query, $event.detail.offset, $event.detail.limit))". Mark that method #[Renderless]: it only returns data. An answer overtaken by a newer search is dropped.
|
combobox-select |
Out |
{ value, option }
Since 1.39. A pick, with the whole option: any key beyond value and label (a document number, a price) comes along. It is cancelable: call $event.preventDefault() to take the pick over, and nothing is stored, the list closes and the field empties for the next pick (add a line to a table, scan the next code).
|
Methods
Available on the component's Alpine scope — call them from markup in the slot
(e.g. @click="…").
| Method | Description |
|---|---|
openList() |
Opens the popover, clears the query and focuses the search input. |
close() |
Closes the popover and returns focus to the trigger. |
select(value) |
Selects the given value (toggles it when multiple). Single select also closes the list. |
remove(value) |
Removes a value from the multiple selection. |