tonegabes/filament-better-options
Installation:
composer require tonegabes/filament-better-options
Publish the config (if needed):
php artisan vendor:publish --provider="ToneGabes\FilamentBetterOptions\FilamentBetterOptionsServiceProvider"
First Use Case:
Replace a basic Filament Checkbox or Radio field with the enhanced version in a resource form:
use ToneGabes\FilamentBetterOptions\Forms\Components\CheckboxList;
CheckboxList::make('status')
->options([
'active' => 'Active',
'inactive' => 'Inactive',
'pending' => 'Pending',
])
->columns(2) // For list layout
// ->layout('CheckboxCards') // For card layout
Where to Look First:
config/filament-better-options.php for global defaults (e.g., theme, debounce time).resources/views/vendor/filament-better-options/ for customization hooks.Replacing Default Filament Fields:
Checkbox/Radio with CheckboxList/RadioList for list layouts or CheckboxCards/RadioCards for card-based UIs.RadioList::make('priority')
->options([
'low' => ['icon' => 'heroicon-o-minus', 'label' => 'Low'],
'medium' => ['icon' => 'heroicon-o-archive', 'label' => 'Medium'],
'high' => ['icon' => 'heroicon-o-exclamation', 'label' => 'High'],
])
->layout('RadioCards')
->theme('modern');
Dynamic Options:
CheckboxList::make('tags')
->options(Tag::all()->pluck('name', 'id'))
->searchable()
->searchDebounce(300);
Bulk Operations:
CheckboxList::make('permissions')
->options(Permission::all()->pluck('name', 'id'))
->bulkActions()
->bulkActionLabel('Select All');
Theming and Styling:
RadioCards::make('theme_example')
->theme('classic')
->iconPosition('after');
Integration with Filament Forms:
public static function form(Form $form): Form
{
return $form
->schema([
CheckboxCards::make('features')
->options([
'notifications' => 'Email Notifications',
'analytics' => 'Analytics Dashboard',
]),
]);
}
heroicon-o-star, tabler-star) or register custom icons via the config.visible()/hidden() methods:
CheckboxList::make('advanced_settings')
->options([...])
->visible(fn ($record) => $record->is_admin);
required(), minItems()) alongside component-specific features.Performance with Large Datasets:
searchDebounce(500) or paginate options server-side (e.g., via ->options(fn () => Option::query()->paginate(50))).Theme Conflicts:
!important sparingly; prefer theme-specific classes (e.g., bg-blue-500 in modern theme).Icon Alias Mismatches:
filament.php config or use full icon paths (e.g., tabler-icons:star).Bulk Actions Edge Cases:
->persistBulkState() or handle state in the form’s dehydrateState() method.Dark Mode Quirks:
dark: variant in your Tailwind config or override component styles.APP_DEBUG=true) to catch JavaScript errors (e.g., debounce failures).php artisan view:clear if styles/icons fail to load after updates.Custom Components:
Extend the base classes (e.g., CheckboxList) to add features like:
namespace App\Filament\Components;
use ToneGabes\FilamentBetterOptions\Forms\Components\CheckboxList;
class CustomCheckboxList extends CheckboxList
{
protected string $view = 'filament-better-options::custom-checkbox-list';
}
Override Views: Publish and modify views:
php artisan vendor:publish --tag="filament-better-options-views"
Then edit resources/views/vendor/filament-better-options/checkbox-list.blade.php.
Add Global JavaScript:
Register scripts in bootstrap.js:
import { initBetterOptions } from 'filament-better-options';
initBetterOptions();
Config Overrides:
Customize defaults in config/filament-better-options.php:
'default_theme' => 'minimal',
'search_debounce' => 400,
'bulk_actions' => [
'label' => 'Select/Deselect All',
'icon' => 'heroicon-o-check',
],
CheckboxList::make('roles')
->options([...])
->afterStateUpdated(fn (Form $form) => $form->dispatchBrowserEvent('roles-updated'));
aria-label or aria-describedby for screen readers:
->extraAttributes(['aria-label' => 'Select user permissions']);
->options([
'draft' => __('filament-better-options::status.draft'),
]);
How can I help you explore Laravel packages today?