Download the PHP package agroezinger/filament-navigation-enhanced without Composer
On this page you can find all versions of the php package agroezinger/filament-navigation-enhanced. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download agroezinger/filament-navigation-enhanced
More information about agroezinger/filament-navigation-enhanced
Files in agroezinger/filament-navigation-enhanced
Package filament-navigation-enhanced
Short Description Adds collapsible child-item support to the Filament sidebar navigation.
License MIT
Homepage https://github.com/agroezinger/filament-navigation-enhanced/
Informations about the package filament-navigation-enhanced
filament-navigation-enhanced
Adds collapsible child-item support to the Filament v5 sidebar navigation. A parent item becomes an expand/collapse toggle; its children are revealed in an animated sub-list. The group auto-expands whenever a child is active.
Requirements
| Dependency | Version |
|---|---|
| PHP | ^8.2 |
| filament/filament | ^5.0 |
Installation
Via Composer (Packagist)
Publish the view override
The package ships a replacement for Filament's sidebar/item component. Publish it once so Filament picks it up:
This copies the view to resources/views/vendor/filament-panels/components/sidebar/item.blade.php.
Usage
1. Register the plugin
Add NavigationEnhancedPlugin to every panel that should use the feature:
2. Register standalone parent items (no Page class needed)
Use parentNavigationItem() to declare a collapsible parent item directly on the plugin — no dummy Page or redirect required:
The child Pages must still opt out of standalone navigation registration:
Call ->parentNavigationItem() multiple times to register more than one standalone parent.
3. Add the trait to a parent Page or Resource
3. Suppress child items from the top-level navigation
Resources and Pages that appear as children should not register themselves as standalone sidebar items. Override shouldRegisterNavigation() on the Resource:
For a child Page, set:
4. Active-state detection
Use request()->routeIs() with a wildcard to match all pages of a resource (index, create, edit):
For a single Page, match the exact route name:
To find the exact route names for your panel, run:
How it works
The package publishes a custom sidebar/item Blade component that extends Filament's default one. When a NavigationItem carries child items (set via $item->childItems([...])), the component renders a <button> toggle instead of an <a> link, and wraps the children in an Alpine.js-powered <ul> with enter/leave transitions.
HasNavigationChildren::getNavigationItems() wraps the parent's items and calls childItems() on each with the return value of getNavigationChildItems(). The parent item auto-expands on load when $active || $activeChildItems is true.
Items without children fall through to Filament's original rendering path unchanged.
License
MIT