magicoli/extra-navigation-items

Filament plugin: render extra NavigationItem lists at any render hook outside the panel's own navigation.

Maintainers

Package info

github.com/magicoli/extra-navigation-items

Language:Blade

pkg:composer/magicoli/extra-navigation-items

Transparency log

Statistics

Installs: 22

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

0.1.1 2026-08-22 13:42 UTC

This package is auto-updated.

Last update: 2026-08-22 13:44:46 UTC


README

A tiny Filament plugin that renders a list of NavigationItem at a render hook instead of inside a panel's own navigation — so the items can reach every page of every panel, not just one panel's own destinations. Use it for cross-panel shortcuts, a footer credit line, or a single entry point another plugin borrows.

At the user menu — its default location — the items sit inside it, in the topbar or the sidebar, so there they render through Filament's own item component for that position and inherit its exact styling, tooltips and active state. That is the one standard place it recognises.

At any other hook it is a menu of its own: it never borrows the main navigation's markup or position, it just renders a plain <ul> of links, the same wherever it lands, carrying an extra-navigation-<group> class (see below) so a host can style one placement — a footer strip, say — without the package presuming anything about where it sits.

Deliberately not "secondary navigation": Filament already documents that term for navigation inside a page, which this is not.

Install

composer require magicoli/extra-navigation-items

The service provider is auto-discovered; there is nothing to publish to use it.

Usage

Attach it to a panel like any Filament plugin. items() takes the same NavigationItems $panel->navigationItems() does.

use Filament\Navigation\NavigationItem;
use Filament\View\PanelsRenderHook;
use Magicoli\ExtraNavigationItems\NavigationItemsPlugin;

$panel
    // Cross-panel shortcuts, right before the user menu (the default hook).
    ->plugin(
        NavigationItemsPlugin::make()->items([
            NavigationItem::make()->label('Admin')->icon('heroicon-o-cog')->url('/admin'),
            NavigationItem::make()->label('Calendar')->icon('heroicon-o-calendar')->url('/calendar'),
        ]),
    )
    // A credit line at the very bottom of the panel.
    ->plugin(
        NavigationItemsPlugin::make()
            ->renderHook(PanelsRenderHook::FOOTER)
            ->items([
                NavigationItem::make()
                    ->label(config('app.name').' '.config('app.version'))
                    ->url('https://github.com/magicoli/extra-navigation-items')
                    ->openUrlInNewTab(),
            ]),
    );

Calls at the same hook add to the one menu there rather than each standing up a separate one: two callers at USER_MENU_BEFORE — a panel's own shortcuts and a module's extra entry, say — build a single menu, in registration order. To keep an independent second menu at a shared hook, give it its own id:

NavigationItemsPlugin::make()
    ->renderHook(PanelsRenderHook::FOOTER)
    ->id('social')
    ->items([...]);

Borrowing the view

Another plugin can render a single item through this plugin's view rather than bespoke markup, so its entry looks like real navigation wherever it lands:

view(NavigationItemsPlugin::VIEW, ['items' => [$item]])->render();

The menu's <ul> carries an extra-navigation-<group> class (the group being the hook, or an explicit id()), so a host can style one placement in CSS without the package presuming anything about it.

Overrides

  • ->renderHook(string $hook) — where the items render (default USER_MENU_BEFORE).
  • ->view(string $view) — a host's own Blade view, for a rendering the default does not cover.

The user menu, signed out

Filament renders the user-menu component — and the USER_MENU_BEFORE / USER_MENU_AFTER hooks inside it — only when a user is signed in (its topbar and sidebar guard the component behind an auth check). On a public panel that leaves the default placement with nothing to attach to when logged out. This package ships opt-in overrides of filament-panels' components/user-menu, livewire/topbar and livewire/sidebar that render the user menu whether or not a user is signed in, so the hooks always have a home. They are forks of Filament's own views — version-coupled by nature — so they are never applied automatically; publish them into your app to opt in:

php artisan vendor:publish --tag=extra-navigation-items-overrides

Once published, the user menu also:

  • puts the user's first name beside the avatar in the trigger;
  • turns the profile header into an Edit profile link (the name is already in the trigger);
  • signed out, makes the trigger go straight to login — opening a menu only when registration or password reset is also enabled.

Everything is resolved through the filament() manager, so it is not tied to any app's routes. The user-menu trigger styling ships as a Filament-served stylesheet; publish extra-navigation-items-styles to restyle.

Notes

  • Items are filtered by isVisible() per render, mirroring what Filament's own NavigationManager does — every item's label, URL and visibility stays a live closure.
  • No URL-required filtering: a label-only entry (a footer app-name/version line) is a legitimate use here, unlike a panel's own clickable navigation.

License

AGPL-3.0-or-later.