Laravel Packages

Laravel Livewire Async Select

Published

The Livewire Async Select package is a powerful select component for Laravel using Livewire and Alpine.js. It provides a simple Livewire component integration with two-way binding, making it an excellent component for asyncronous searching of large datasets.

Here's a basic example of using the blade component:

<livewire:async-select
wire:model="userId"
endpoint="/api/users/search"
placeholder="Search users..."
/>

To go with the Livewire component, here's an example of the search endpoint:

Route::get('/api/users/search', function (Request $request) {
$search = $request->get('search', '');
 
$users = User::query()
->when($search, fn($q) => $q->where('name', 'like', "%{$search}%"))
->limit(20)
->get()
->map(fn($user) => [
'value' => $user->id,
'label' => $user->name,
]);
 
return response()->json(['data' => $users]);
});

Main Features

  • Asynchronous Loading - Load options dynamically from API endpoints
  • Search & Filter - Built-in search with debouncing
  • Multiple Selection - Beautiful chip/tag display
  • Alpine.js Powered - Lightweight, no jQuery dependency
  • Styled with Tailwind CSS - Pre-built styles with las- prefix
  • Custom Slots - Fully customizable rendering
  • Easy Integration - Native Livewire component
  • Two-way Binding - Full wire:model support

Learn More

Check out the documentation and examples to get started with Livewire Async Select.

The source code is available on GitHub.

Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Sponsored

laravelcloud logo
Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Visit Laravel Cloud

The latest

View all →
CPX: The Composer Package Executor for PHP image

CPX: The Composer Package Executor for PHP

Read article
Laravel AI SDK Adds Human-in-the-Loop Tool Approval image

Laravel AI SDK Adds Human-in-the-Loop Tool Approval

Read article
Pest 5 Released With Test Impact Analysis, Agent Verification, and Evals image

Pest 5 Released With Test Impact Analysis, Agent Verification, and Evals

Read article
Queue-SQL: Run Mass Deletes and Updates Across Parallel Queue Jobs image

Queue-SQL: Run Mass Deletes and Updates Across Parallel Queue Jobs

Read article
Blade Formatting in Laravel Pint image

Blade Formatting in Laravel Pint

Read article
Inertia DevTools Is Now on the Chrome Web Store image

Inertia DevTools Is Now on the Chrome Web Store

Read article