harvirsidhu / filament-header-actions
Compose Filament header actions into primary actions plus a More overflow menu.
Package info
github.com/harvirsidhu/filament-header-actions
pkg:composer/harvirsidhu/filament-header-actions
Fund package maintenance!
v1.0.5
2026-02-20 16:18 UTC
Requires
- php: ^8.2
- filament/filament: ^4.0 || ^5.0
- spatie/laravel-package-tools: ^1.15.0
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.0
- nunomaduro/collision: ^8.0
- orchestra/testbench: ^9.0|^10.0
- pestphp/pest: ^3.7|^4.0
- pestphp/pest-plugin-arch: ^3.0|^4.0
- pestphp/pest-plugin-laravel: ^3.0|^4.0
- pestphp/pest-plugin-livewire: ^3.0|^4.0
- rector/rector: ^2.0
- spatie/laravel-ray: ^1.26
README
filament-header-actions composes an ordered list of Filament actions into:
- primary actions (first
N, default1), - and a
Moreoverflow action group for remaining actions.
Behavior is deterministic:
- no overflow => no
More, - one overflow action => flattened directly,
- two or more overflow actions => grouped under
More. - actions that evaluate as hidden or invisible are ignored before composing.
- authorization filtering is opt-in via
filter_unauthorized(defaultfalse).
Compatibility
| Package | Supported versions |
|---|---|
| Filament | ^4.0 and ^5.0 |
| PHP | ^8.2 |
Installation
composer require harvirsidhu/filament-header-actions
Config is optional. The package works without publishing it.
If you want to customize defaults, publish config:
php artisan vendor:publish --tag="filament-header-actions-config"
return [ 'primary_count' => 1, 'label' => 'More', 'icon' => 'heroicon-m-ellipsis-horizontal', 'color' => 'gray', 'hidden_label' => false, 'button' => true, 'icon_position' => \Filament\Support\Enums\IconPosition::After, // right 'filter_unauthorized' => false, ];
Usage
Easy usage
use Filament\Actions\Action; use Harvirsidhu\FilamentHeaderActions\Facades\FilamentHeaderActions; public function getHeaderActions(): array { $actions = [ Action::make('edit'), Action::make('archive'), Action::make('delete'), ]; return FilamentHeaderActions::make($actions)->toActions(); }
Visibility filtering example
public function getHeaderActions(): array { $actions = [ Action::make('edit')->hidden(true), // ignored Action::make('archive'), // kept Action::make('delete')->visible(false), // ignored Action::make('publish')->authorize('update', $this->record), // kept by default ]; // primary_count = 1: // - first available action stays primary // - remaining available actions go to More (or flatten if only one) return FilamentHeaderActions::make($actions)->toActions(); }
Optional authorization pre-filtering
return FilamentHeaderActions::make($actions) ->filterUnauthorized() // opt-in (default is false) ->toActions();
Full usage (all options)
FilamentHeaderActions::make($actions) ->primaryCount(int $count = 1) ->label(string $label = 'More') ->icon(string|\BackedEnum|null $icon = null) ->color(string $color = 'gray') ->hiddenLabel(bool $state = true) ->button(bool $state = true) ->iconPosition(\Filament\Support\Enums\IconPosition $position = \Filament\Support\Enums\IconPosition::After) ->filterUnauthorized(bool $state = true) ->toActions();
Testing
composer test
Release checklist
- Update changelog with user-facing changes.
- Run linting and static analysis.
- Run Pest locally.
- Ensure CI passes Filament 4 and 5 matrix jobs.
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.