Skip to content
Guides
Navigation
Feedback
Overlays
Layout
Data Display
Forms
.md

Forms

combobox

Searchable select: a trigger opens a filterable list of options with full keyboard support. Submits with the form through a hidden input.

Installation

php artisan ui:add combobox

Usage

<x-ui.combobox name="framework" :options="$frameworks"
    placeholder="Select framework..." />

{{-- Preselected value, translated copy, disabled --}}
<x-ui.combobox name="country" :options="$countries" value="ae"
    search-placeholder="Search country..." empty="No country found." />
<x-ui.combobox name="plan" :options="$plans" disabled />

{{-- Livewire / Alpine: the attribute lands on the hidden input --}}
<x-ui.combobox wire:model.live="framework" :options="$frameworks" />

{{-- React to the value: change bubbles from the hidden input --}}
<x-ui.combobox name="framework" :options="$frameworks"
    onchange="console.log('Picked', event.target.value)" />

Pass name, :options as ['value' => 'Label'] and an optional value; placeholder, search-placeholder and empty set the copy. A hidden input carries the value and fires bubbling input and change events, and receives wire:model, x-model and other unknown attributes, while id goes on the trigger so a label can point at it. Ships its own inline script, no JS dependencies.

Props

Every prop with its default. Pass any of them as attributes, using : to bind a PHP value.

@props([
    'name' => null,
    'options' => [],
    'value' => null,
    'placeholder' => 'Select an option...',
    'searchPlaceholder' => 'Search...',
    'empty' => 'No results.',
    'disabled' => false,
])