---
title: "combobox"
description: "Searchable select: a trigger opens a filterable list of options with full keyboard support. Submits with the form through a hidden input."
category: "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
```bash
php artisan ui:add combobox
```
## Dependencies
- composer: `gehrisandro/tailwind-merge-laravel`
## Usage
```blade
{{-- Preselected value, translated copy, disabled --}}
{{-- Livewire / Alpine: the attribute lands on the hidden input --}}
{{-- React to the value: change bubbles from the hidden input --}}
```
## Example
The demo rendered on the docs page.
```blade
@php
// In a real app these come from the controller.
$frameworks = [
'laravel' => 'Laravel',
'symfony' => 'Symfony',
'rails' => 'Ruby on Rails',
'django' => 'Django',
'phoenix' => 'Phoenix',
'nextjs' => 'Next.js',
'sveltekit' => 'SvelteKit',
'nuxt' => 'Nuxt',
];
@endphp
Framework
```
## Source
Copy this file to the path shown above it.
`resources/views/components/ui/combobox.blade.php`
```blade
@props([
'name' => null,
'options' => [],
'value' => null,
'placeholder' => 'Select an option...',
'searchPlaceholder' => 'Search...',
'empty' => 'No results.',
'disabled' => false,
])
@php
// A searchable select. The value lives in a hidden input, so it submits
// with a normal form and fires a bubbling change event when it changes.
// `id` lands on the trigger button (so a label's for= points at it),
// `class` and `style` on the wrapper, everything else (wire:model,
// x-model, x-on:change, form, data-*) on the hidden input.
$id = 'ui-combobox-' . bin2hex(random_bytes(4));
$selected = $value !== null && array_key_exists((string) $value, $options) ? (string) $value : null;
$classes = \TailwindMerge\Laravel\Facades\TailwindMerge::merge(
'group/combobox relative w-full text-start',
$attributes->get('class'),
);
@endphp
@foreach ($options as $optionValue => $optionLabel)
{{ $optionLabel }}
@endforeach
{{ $empty }}
@once
@endonce
```
## Theme tokens
`--input`, `--popover`, `--popover-foreground`, `--accent`, `--accent-foreground`, `--muted-foreground`, `--ring`, `--radius`
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.