harvirsidhu/filament-header-actions
最新稳定版本:v1.0.5
Composer 安装命令:
composer require harvirsidhu/filament-header-actions
包简介
Compose Filament header actions into primary actions plus a More overflow menu.
README 文档
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.
统计信息
- 总下载量: 83
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-20