Description bla bla bla ...
You can install the package via composer:
composer require prvious/filament-comboboxOptionally, you can publish the views using
php artisan vendor:publish --tag="filament-combobox-views"This is the contents of the published config file:
return [
];use Prvious\Filament\Combobox\Components\Combobox;
Combobox::make('status')
->options([
'draft' => 'Draft',
'published' => 'Published',
'archived' => 'Archived',
])You can set a search query that will be displayed in the search input when the component loads:
Combobox::make('product')
->searchable()
->options([
// your options
])
->searchQuery('electronics')This will populate the search input with "electronics" but will not trigger a search automatically.
If you want to perform a search automatically when the component boots, use the autoSearch() method along with searchQuery():
Combobox::make('product')
->searchable()
->getSearchResultsUsing(function (string $search) {
return Product::where('name', 'like', "%{$search}%")
->limit(50)
->pluck('name', 'id')
->toArray();
})
->searchQuery('electronics')
->autoSearch()This is useful when you want to pre-filter options based on context, such as:
- Showing products from a specific category
- Filtering items based on user permissions
- Displaying search results based on a related field value
You can also conditionally enable auto-search:
Combobox::make('product')
->searchable()
->searchQuery($categoryName)
->autoSearch(filled($categoryName))Note: The autoSearch() method requires that the component is searchable and has a search handler configured.
composer testPlease see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.