- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Attachment
- Avatar
- Badge
- Banner
- Breadcrumb
- Bubble
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Command
- Collapsible
- Combobox
- Context Menu
- Data Table
- Date Picker
- Dialog
- Dropdown Menu
- Editor
- Input
- Input Group
- Label
- Loading Spinner
- Native Select
- Popover
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Steps
- Switch
- Tabs
- Textarea
- Tooltip
Combobox
An input with a searchable list of selectable options.
<april:combobox name="framework" placeholder="Select a framework" class="max-w-sm" x-teleport="body"> <slot:empty>No framework found.</slot:empty> <april:combobox-option value="laravel">Laravel</april:combobox-option> <april:combobox-option value="livewire">Livewire</april:combobox-option> <april:combobox-option value="alpine">Alpine.js</april:combobox-option> <april:combobox-option value="tailwind">Tailwind CSS</april:combobox-option></april:combobox>
<april:combobox name="framework" placeholder="Select a framework" class="max-w-sm" x-teleport="body"> <slot:empty>No framework found.</slot:empty> <april:combobox-option value="laravel">Laravel</april:combobox-option> <april:combobox-option value="livewire">Livewire</april:combobox-option> <april:combobox-option value="alpine">Alpine.js</april:combobox-option> <april:combobox-option value="tailwind">Tailwind CSS</april:combobox-option></april:combobox>
Each option is a child component because a combobox can contain multiple options. The default slot holds those options, while empty provides the empty-state message.
<april:combobox name="framework" placeholder="Select a framework"> <slot:empty>No framework found.</slot:empty> <april:combobox-option value="laravel">Laravel</april:combobox-option> <april:combobox-option value="livewire">Livewire</april:combobox-option></april:combobox>
<april:combobox name="framework" placeholder="Select a framework"> <slot:empty>No framework found.</slot:empty> <april:combobox-option value="laravel">Laravel</april:combobox-option> <april:combobox-option value="livewire">Livewire</april:combobox-option></april:combobox>
The selected value is submitted under the name attribute. The component dispatches value-change with { detail: { value } }; the existing change event remains available.
The panel stays in the component flow by default. Use x-teleport="body" when the panel must escape an overflow or
stacking context, just like the other April overlay components.
Use value for the initial selection or wire:model for a Livewire-bound value. Values are compared as strings so numeric model IDs work with option values rendered in HTML. The trigger supports Enter, Space, and Arrow Down; the search field supports Arrow Up, Arrow Down, Enter, and Escape.
Accessibility
The search field carries role="combobox". It reports its state through
aria-expanded, names its list through aria-controls, and names the option
under the keyboard through aria-activedescendant. The trigger reports the
same state and carries aria-haspopup="listbox". The list carries
role="listbox" and points back at the trigger with aria-labelledby.
Publishing Views
Use the following commands to publish these views:
php artisan april:publish combobox
php artisan april:publish combobox
php artisan april:publish combobox-option
php artisan april:publish combobox-option
php artisan april:publish --all
php artisan april:publish --all