mrpunyapal / filament-infinite-select
A Filament Select component with infinite scroll lazy loading for options
Package info
github.com/MrPunyapal/filament-infinite-select
pkg:composer/mrpunyapal/filament-infinite-select
Fund package maintenance!
Requires
- php: ^8.2
- filament/forms: ^4.0|^5.0
- illuminate/contracts: ^11.28|^12.0|^13.0
- spatie/laravel-package-tools: ^1.16.0
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.18
- mrpunyapal/docsmith: ^0.3.1
- nunomaduro/collision: ^8.9
- orchestra/testbench: ^10.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-arch: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- phpstan/extension-installer: ^1.3
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
README
A Filament form component that loads select options one page at a time as the user scrolls. Use it when a select can contain hundreds or thousands of options and loading them all at once is too slow.
Options are fetched through a closure you provide. The dropdown appends each page on scroll, search queries your closure server side with debouncing, and saved values resolve their labels through separate closures so they display correctly even when they are not on the first page.
Requirements
- PHP 8.2 or higher
- Filament 4.x or 5.x
- Laravel 11.28 or higher
Documentation
The documentation is available at mrpunyapal.github.io/filament-infinite-select.
Using AI agents (Claude Code, Cursor, Boost, ...)? The package ships an installable skill:
npx skills add MrPunyapal/filament-infinite-select/resources/boost/skills
# or, in a Laravel project with Boost:
php artisan boost:install
Quick example
use MrPunyapal\FilamentInfiniteSelect\InfiniteSelect; InfiniteSelect::make('user_id') ->getPaginatedOptionsUsing(function (int $offset, int $limit, ?string $search) { $query = User::query()->orderBy('name'); if ($search) { $query->where('name', 'like', "%{$search}%"); } $total = (clone $query)->count(); return [ 'options' => $query->skip($offset)->take($limit)->pluck('name', 'id')->all(), 'hasMore' => ($offset + $limit) < $total, ]; }) ->getOptionLabelUsing(fn ($value) => User::find($value)?->name);
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.