xuanpablo/filament-palette

A Spotlight/CMD+K style command palette for quick navigation and actions across Filament panels.

Maintainers

Package info

github.com/xuanpablo/filament-palette

pkg:composer/xuanpablo/filament-palette

Fund package maintenance!

xuanpablo

Statistics

Installs: 34

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v2.3.0 2026-06-08 23:31 UTC

README

Latest Version on Packagist Total Downloads Licence

Filament Palette

A Spotlight/CMD+K style command palette for quick navigation and actions across Filament panels.

Fuzzy search with match highlighting, recent commands, and full keyboard navigation — adapts to your panel's primary colour in both light and dark mode.

Features

  • Keyboard shortcut: Press Cmd+K (Mac) or Ctrl+K (Windows/Linux) to open
  • Quick navigation: Jump to any page, resource, or navigation item
  • Fuzzy search: Results are scored, ranked, and the matched characters are highlighted
  • Recent commands: Recently used commands are remembered per panel and shown first
  • Keyboard-first: Arrow keys (with wrap-around), Home/End, Enter to open, Esc to close, plus an on-screen hint footer
  • Rich results: Optional descriptions and extra search keywords per command
  • Authorization-aware: Only shows pages and resources the current user can actually access (respects canAccess() / canCreate())
  • SPA navigation: Results navigate via Filament's wire:navigate for instant transitions
  • Accessible: Focus trap, scroll lock, focus restoration, and prefers-reduced-motion support
  • Translatable: All UI strings ship through a publishable language file
  • Theme-aware: Adapts to your panel's primary colour and looks great in light and dark mode
  • Optional topbar button: Click to open from the topbar

Installation

composer require xuanpablo/filament-palette

Setup

Register the plugin in your Filament panel provider:

use Xuanpablo\CommandPalette\CommandPalettePlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            CommandPalettePlugin::make(),
            // ...
        ]);
}

Upgrading from 1.x to 2.0

The package name is unchanged (xuanpablo/filament-palette), but the PHP namespace and entry-point classes were renamed. Update your imports:

- use Xuanpablo\FilamentPalette\FilamentPalettePlugin;
+ use Xuanpablo\CommandPalette\CommandPalettePlugin;

- ->plugins([FilamentPalettePlugin::make()])
+ ->plugins([CommandPalettePlugin::make()])

If you reference other classes (e.g. CommandItem), swap the namespace prefix Xuanpablo\FilamentPalette\Xuanpablo\CommandPalette\. The config file/key, view namespace, publish tags, and translations are unchanged, so published config and views need no changes.

Configuration

Publish the config file (optional):

php artisan vendor:publish --tag=filament-palette-config

Options in config/filament-palette.php:

  • key_bindings: Keyboard shortcuts (default: ['mod+k'])
  • show_topbar_button: Show a trigger affordance in the topbar (default: true). When global search is disabled this is a full search-style button; when global search is enabled it becomes a compact ⌘K hint embedded in Filament's global-search field.
  • show_topbar_button_when_global_search_enabled: Show the full standalone button (instead of the compact hint) even when global search is enabled, giving two side-by-side controls (default: false)
  • max_results: Max results shown while searching (default: 10)
  • placeholder: Search input placeholder text (default: null, falls back to the translatable default)
  • show_footer: Show the keyboard-hint footer (default: true)
  • show_recent: Remember and surface recently used commands (default: true)
  • recent_limit: How many recent commands to keep (default: 5)
  • include_global_search_results: Also show matching records from the panel's global search provider as you type (default: false). Adds a debounced server round-trip per search; requires a global search provider. Tune with global_search_results_limit (default 10) and global_search_debounce_ms (default 300).
  • include_publish_views_command: Show "Publish views" in the command palette (default: true)
  • custom_commands: Array of closures returning CommandItem[] for extensibility

Publishing Views

You can publish the package views to customize the command palette layout, styling, and behavior. Published views go to resources/views/vendor/filament-palette/ and can be edited freely.

From the command palette: Open the palette (Cmd+K), search for "Publish views", and select it to open a page with a one-click publish button.

From the terminal:

php artisan filament-palette:publish-views

Or using Laravel's vendor publish directly:

php artisan vendor:publish --tag=filament-palette-views

Use --force to overwrite existing published views.

Custom Commands

Add custom commands via config:

use Xuanpablo\CommandPalette\Support\CommandItem;

'custom_commands' => [
    fn () => [
        CommandItem::make('My Action', '/my-url', 'Custom'),

        // Richer item with a description (second line) and extra search keywords
        CommandItem::make('Billing', '/admin/billing')
            ->group('Finance')
            ->description('Manage invoices and payments')
            ->keywords(['invoices', 'payments', 'subscriptions']),

        // Action command: dispatches a browser event instead of navigating
        CommandItem::action('Toggle dark mode', 'toggle-theme', ['mode' => 'dark']),
    ],
],

Action commands

Use CommandItem::action() (or ->dispatch() on any item) to run something instead of navigating. Selecting it fires a browser CustomEvent; the payload arrives as event.detail. Listen from JavaScript:

window.addEventListener('toggle-theme', (e) => { /* e.detail.mode */ });

or, for server-side handling, from a Livewire component:

#[\Livewire\Attributes\On('toggle-theme')]
public function toggleTheme(array $detail): void { /* … */ }

Available CommandItem methods: ->group(), ->icon(), ->description(), ->keywords(), ->openInNewTab(), and ->dispatch(). Factories: CommandItem::make($label, $url) for navigation and CommandItem::action($label, $event, $data) for actions.

Authorization

Auto-discovered pages and resources are filtered by Filament's authorization gates: pages and resources are only shown when canAccess() returns true, and the "Create" entry only appears when canCreate() passes. Gates that throw are treated as denied (fail-closed). Custom commands you add via custom_commands are your responsibility to guard.

Translations

All UI strings live in a publishable language file:

php artisan vendor:publish --tag=filament-palette-translations

Then edit lang/vendor/filament-palette/{locale}/filament-palette.php.

Bundled locales: English (en), Chinese Simplified (zh_CN), Hindi (hi), Spanish (es), Portuguese – Brazil (pt_BR), Japanese (ja), Russian (ru), German (de), French (fr), and Korean (ko). Filament picks the active locale from app()->getLocale().

Requirements

  • PHP 8.4+
  • Filament v5
  • Laravel 13

Screenshots

Searching, with fuzzy match highlighting (light mode):

Command palette searching, light mode

Recent commands on an empty search (dark mode):

Command palette recent commands, dark mode

License

MIT