harvirsidhu/filament-header-actions

Compose Filament header actions into primary actions plus a More overflow menu.

Maintainers

Package info

github.com/harvirsidhu/filament-header-actions

pkg:composer/harvirsidhu/filament-header-actions

Fund package maintenance!

harvirsidhu

Statistics

Installs: 51

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.5 2026-02-20 16:18 UTC

This package is auto-updated.

Last update: 2026-03-20 16:30:59 UTC


README

Latest Version on Packagist Total Downloads

filament-header-actions composes an ordered list of Filament actions into:

  • primary actions (first N, default 1),
  • and a More overflow 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 (default false).

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.