php artisan aura:add multiselect
Copies the component source into resources/views/components/aura/. Run php artisan aura:init first if you haven't already. See the CLI guide for all options.
composer require bluestarsystem/aura-ui
php artisan aura:install
Full installation instructions in the Installation guide.
Overview
The <x-aura::multiselect> component lets users pick multiple items from a dropdown list. Selected items appear as removable chips inside the control. It supports keyboard navigation, optional search filtering, a maximum selection limit, and a clear-all button. Options are passed as a PHP array and the selected values are bound via wire:model (expects an array).
Basic Usage
<x-aura::multiselect
label="Technologies"
:options="['laravel' => 'Laravel', 'livewire' => 'Livewire', 'alpine' => 'Alpine.js', 'tailwind' => 'Tailwind CSS', 'inertia' => 'Inertia.js']"
placeholder="Select technologies..."
/><x-aura::multiselect
label="Technologies"
:options="['laravel' => 'Laravel', 'livewire' => 'Livewire', 'alpine' => 'Alpine.js']"
placeholder="Select technologies..."
wire:model="selectedTech"
/>
Props
| Prop | Type | Default | Description |
|---|---|---|---|
label |
string|null |
null |
Label text displayed above the multiselect. |
options |
array |
[] |
Options array. Associative (value => label) or flat (value used as label). |
placeholder |
string |
'Select...' |
Placeholder shown when nothing is selected. |
searchable |
bool |
true |
Show a search input to filter options. |
max |
int|null |
null |
Maximum number of selections allowed. null for unlimited. |
clearable |
bool |
true |
Show a clear-all button when at least one item is selected. |
disabled |
bool |
false |
Disable the entire control. |
error |
string|null |
null |
Error message displayed below the control, applying error styling. |
hint |
string|null |
null |
Help text displayed below the control. Hidden when an error is present. |
size |
string |
'md' |
Size variant. Options: sm, md, lg. |
Variants / Examples
With Maximum Selection
<x-aura::multiselect
label="Choose up to 2 frameworks"
:options="['react' => 'React', 'vue' => 'Vue.js', 'svelte' => 'Svelte', 'angular' => 'Angular']"
:max="2"
placeholder="Pick two..."
/><x-aura::multiselect
label="Choose up to 2 frameworks"
:options="['react' => 'React', 'vue' => 'Vue.js', 'svelte' => 'Svelte', 'angular' => 'Angular']"
:max="2"
placeholder="Pick two..."
wire:model="selectedFrameworks"
/>
Non-Searchable
<x-aura::multiselect
label="Priority"
:options="['low' => 'Low', 'medium' => 'Medium', 'high' => 'High', 'critical' => 'Critical']"
:searchable="false"
placeholder="Select priority levels..."
/><x-aura::multiselect
label="Priority"
:options="['low' => 'Low', 'medium' => 'Medium', 'high' => 'High', 'critical' => 'Critical']"
:searchable="false"
wire:model="priorities"
/>
With Error State
Please select at least one category.
<x-aura::multiselect
label="Categories"
:options="['news' => 'News', 'tutorial' => 'Tutorial', 'opinion' => 'Opinion']"
error="Please select at least one category."
/><x-aura::multiselect
label="Categories"
:options="$categoryOptions"
error="Please select at least one category."
wire:model="categories"
/>
With Hint Text
Select all channels you want to receive notifications on.
<x-aura::multiselect
label="Notifications"
:options="['email' => 'Email', 'sms' => 'SMS', 'push' => 'Push', 'slack' => 'Slack']"
hint="Select all channels you want to receive notifications on."
/><x-aura::multiselect
label="Notification Channels"
:options="['email' => 'Email', 'sms' => 'SMS', 'push' => 'Push', 'slack' => 'Slack']"
hint="Select all channels you want to receive notifications on."
wire:model="channels"
/>
Livewire Integration
<x-aura::multiselect
label="Assigned Tags"
:options="$availableTags"
:max="5"
placeholder="Choose tags..."
hint="Up to 5 tags allowed."
wire:model.live="selectedTags"
/>
class PostEditor extends Component
{
public array $selectedTags = [];
public array $availableTags = [];
public function mount(): void
{
$this->availableTags = Tag::pluck('name', 'id')->toArray();
}
}
Flat Options Array
When options are passed as a flat (non-associative) array, the value and label are both set to the string itself:
<x-aura::multiselect
label="Skills"
:options="['PHP', 'JavaScript', 'Python', 'Go', 'Rust']"
wire:model="skills"
/>
Keyboard Navigation
| Key | Action |
|---|---|
ArrowDown |
Open dropdown / move highlight down |
ArrowUp |
Move highlight up |
Enter |
Select highlighted option |
Backspace (empty search) |
Remove the last selected chip |
Escape |
Close dropdown |
Accessibility
- When a
labelprop is provided, a<label>element is rendered above the control. - The dropdown uses
role="listbox"and each option hasrole="option"witharia-selected. - Each chip's remove button has
aria-label="Remove". - The clear-all button has
aria-label="Clear all". - Error messages are rendered in a
<p>tag styled with theaura-input-error-textclass. - The disabled state is applied via
opacity-50 pointer-events-noneand the search input receives the HTMLdisabledattribute. - All additional HTML attributes (including
aria-*,id) are forwarded to the outer wrapper via Blade's attribute bag.