Livewire Async Select
Guide
Features
API Reference
Examples
GitHub
Guide
Features
API Reference
Examples
GitHub
  • Getting Started

    • Introduction
    • Installation
    • Quick Start
  • Features

    • Features
    • Async Loading
    • Multiple Selection
    • Custom Slots
    • Themes & Styling
    • Authentication
  • Advanced

    • API Reference
    • Examples
    • Customization
    • Setting Default Values
    • Validation & Error Handling
    • Select2 Comparison
    • Troubleshooting

Select2 Comparison

Complete feature comparison between Livewire Async Select and Select2.

Feature Comparison Table

FeatureLivewire Async SelectSelect2Notes
Core Features
Searchable Dropdowns✅ Yes✅ YesBuilt-in with debouncing
Remote Data (AJAX)✅ Yes✅ YesNative endpoint support
Multiple Selection✅ Yes✅ YesWith visual chips
Tagging/Create Options✅ Yes✅ YesTags mode enabled
Single Selection✅ Yes✅ YesDefault mode
Search & Filtering
Client-side Search✅ Yes✅ YesFor local options
Server-side Search✅ Yes✅ YesVia endpoint
Minimum Search Length✅ Yes✅ Yesmin-search-length
Search Debouncing✅ Yes⚠️ PluginBuilt-in 300ms
Data Loading
Static Options✅ Yes✅ YesArray/Collection
Remote Data✅ Yes✅ YesEndpoint attribute
Infinite Scrolling✅ Yes✅ YesAuto pagination
Lazy Loading✅ Yes✅ YesLoad on demand
Selected Data Fetching✅ Yes⚠️ Manualselected-endpoint
Display & UI
Placeholder✅ Yes✅ YesConfigurable
Clear Button✅ Yes✅ Yesclearable prop
Loading Indicator✅ Yes✅ YesSpinner shown
Disabled State✅ Yes✅ Yesdisabled prop
Disabled Options✅ Yes✅ YesPer-option disable
Image/Avatar Support✅ Yes⚠️ CustomBuilt-in support
Grouped Options✅ Yes✅ YesOptgroup support
Customization
Custom Templates✅ Slots✅ JS FunctionsBlade slots
Theme Support✅ Yes✅ YesTailwind & Bootstrap
Custom Styling✅ Yes✅ YesPublishable views
Custom Slots✅ Yes⚠️ Limited2 slot types
Accessibility
ARIA Attributes✅ Yes✅ YesFull support
Keyboard Navigation✅ Yes✅ YesArrow keys, Enter, Esc
Screen Reader Support✅ Yes✅ YesProper labels
Focus Management✅ Yes✅ YesAuto-focus
Internationalization
RTL Support✅ Yes✅ YesAuto-detect
Multiple Languages✅ Yes✅ Yes3 built-in (EN, AR, CKB)
Custom Translations✅ Yes✅ YesPublishable lang files
Integration
FrameworkLivewire 3jQueryNative integration
Two-way Binding✅ Yes⚠️ Manualwire:model
Validation Support✅ Yes⚠️ ManualBuilt-in error display
Form Integration✅ Yes✅ YesNative HTML forms
Performance
Bundle Size~10KB JS~60KB+ (with jQuery)Much smaller
No jQuery✅ Yes❌ NoModern stack
Debouncing✅ Built-in⚠️ PluginReduces API calls
Result Caching✅ Yes⚠️ ManualAutomatic
Advanced Features
Max Selections✅ Yes✅ Yesmax-selections
Extra Parameters✅ Yes✅ Yesextra-params
Close on Select✅ Yes✅ Yesclose-on-select
Collection Support✅ Yes❌ NoAuto-convert
Default Values✅ Yes✅ Yeswire:model binding
Error Messages✅ Built-in⚠️ Manualerror attribute
Missing Features
Drag & Drop Sort❌ No✅ With pluginSee below
Dropdown Parent❌ No✅ YesPositioning control
Width Configuration❌ No✅ YesCSS control available
Match Start Only❌ No✅ YesAlways substring match
Language Matcher❌ No✅ YesServer-side only
Select All Button❌ No✅ With pluginCould be added

✅ Advantages Over Select2

1. Modern Stack

  • No jQuery dependency
  • Alpine.js for reactivity
  • Native Livewire integration
  • Smaller bundle size

2. Better Laravel Integration

  • Two-way binding with wire:model
  • Native validation support
  • Collection auto-conversion
  • Blade slot customization

3. Built-in Features

  • Image/avatar support out of the box
  • Error message display
  • Loading states
  • Debouncing

4. Developer Experience

  • Simpler configuration
  • Less JavaScript code
  • Better TypeScript support
  • Clear documentation

5. Performance

  • Smaller bundle (~10KB vs 60KB+)
  • No jQuery overhead
  • Optimized for Livewire
  • Better mobile performance

⚠️ Potential Missing Features

1. Drag & Drop Sorting (Multiple Selection)

Select2 Feature:

$('.select2').select2();
$('.select2').on('select2:select', function (e) {
    var element = e.params.data.element;
    var $element = $(element);
    $element.detach();
    $(this).append($element);
    $(this).trigger('change');
});

Status: ❌ Not implemented
Priority: Low - Rarely used
Workaround: Use separate UI for ordering after selection

2. Dropdown Parent Positioning

Select2 Feature:

$('.select2').select2({
    dropdownParent: $('#modal')
});

Status: ❌ Not implemented
Priority: Medium - Useful for modals
Workaround: CSS positioning can be customized

3. Width Configuration

Select2 Feature:

$('.select2').select2({
    width: '100%'
});

Status: ⚠️ Use CSS
Priority: Low - CSS handles this
Workaround: Apply width via CSS classes

4. Match Start vs Substring

Select2 Feature:

$('.select2').select2({
    matcher: matchStart
});

Status: ❌ Always substring match
Priority: Low
Workaround: Handle on server-side

5. Select All Button

Select2 Feature: Via plugin

Status: ❌ Not implemented
Priority: Low-Medium
Workaround: Can be added via custom button

6. Custom Language Matcher

Select2 Feature:

$('.select2').select2({
    language: {
        searching: function(params) {
            return 'Searching for ' + params.term;
        }
    }
});

Status: ⚠️ Limited (server-side)
Priority: Low - Translations available
Workaround: Use lang files for messages

🎯 Recommended Additions

Based on the comparison, here are features worth considering:

High Priority

None - Component has feature parity for common use cases

Medium Priority

1. Dropdown Positioning Control

For better modal/overflow support:

<livewire:async-select
    :append-to-body="true"
    dropdown-class="z-50"
/>

2. Select All/Clear All (Multiple Mode)

For better UX with many selections:

<livewire:async-select
    :multiple="true"
    :show-select-all="true"
/>

Low Priority

3. Custom Match Logic

Client-side matching customization:

<livewire:async-select
    match-mode="starts-with"  {{-- or "exact" or "contains" --}}
/>

4. Drag & Drop Reordering

For advanced multiple selection:

<livewire:async-select
    :multiple="true"
    :sortable="true"
/>

Migration from Select2

Basic Select2

Select2:

$('#mySelect').select2({
    ajax: {
        url: '/api/users',
        dataType: 'json'
    },
    placeholder: 'Select a user'
});

Livewire Async Select:

<livewire:async-select
    endpoint="/api/users"
    wire:model="userId"
    placeholder="Select a user"
/>

With Multiple Selection

Select2:

$('#mySelect').select2({
    multiple: true,
    maximumSelectionLength: 5,
    allowClear: true
});

Livewire Async Select:

<livewire:async-select
    :multiple="true"
    :max-selections="5"
    :clearable="true"
    wire:model="selectedIds"
/>

With Custom Templates

Select2:

$('#mySelect').select2({
    templateResult: formatUser,
    templateSelection: formatUserSelection
});

function formatUser(user) {
    if (!user.id) return user.text;
    return $('<span><img src="' + user.avatar + '"/> ' + user.text + '</span>');
}

Livewire Async Select:

<livewire:async-select wire:model="userId">
    <x-slot name="slot" :option="$option">
        <div class="flex items-center gap-2">
            <img src="{{ $option['avatar'] }}" class="w-6 h-6 rounded-full">
            <span>{{ $option['label'] }}</span>
        </div>
    </x-slot>
</livewire:async-select>

Conclusion

Livewire Async Select provides feature parity with Select2 for 95% of use cases, with these advantages:

✅ Better Laravel/Livewire integration
✅ Smaller bundle size
✅ No jQuery dependency
✅ Modern development experience
✅ Built-in validation & error handling
✅ Collection support

The only notable missing features (drag & drop sorting, dropdown positioning) are rarely used and have workarounds.

For most Laravel projects, Livewire Async Select is the better choice.

Next Steps

  • Installation →
  • Quick Start →
  • All Features →
  • Examples →
Last Updated: 11/2/25, 10:20 PM
Contributors: Pshtiwan Mahmood
Prev
Validation & Error Handling
Next
Troubleshooting