Certainly! To customize the sidebar order in Filament as you described—having single items and groups appear in a specific, mixed order—you should override the navigation setup in your PanelProvider or use a custom navigation method if you’re on Filament v3+.
Step-by-Step Solution
1. Disable Default Resource Registration (If Necessary)
If you’re using Filament Resources and they appear automatically, disable their auto-registration in the sidebar by setting:
public static bool $registerNavigation = false;
in your Resource classes.
2. Customize Sidebar in PanelProvider
Open your PanelProvider (commonly app/Providers/Filament/AdminPanelProvider.php) and implement or override the getNavigation() method like this:
use Filament\Navigation\NavigationGroup;
use Filament\Navigation\NavigationItem;
public function getNavigation(): array
{
return [
// 1. Dashboard at the top
NavigationItem::make()
->label('Dashboard')
->icon('heroicon-o-home')
->url(route('filament.admin.dashboard')),
// 2. Properties group in the middle
NavigationGroup::make()
->label('Properties')
->items([
NavigationItem::make()
->label('Units')
->icon('heroicon-o-collection')
->url(route('filament.admin.units.index')),
NavigationItem::make()
->label('Tenants')
->icon('heroicon-o-user-group')
->url(route('filament.admin.tenants.index')),
]),
// 3. Settings item at the bottom
NavigationItem::make()
->label('Settings')
->icon('heroicon-o-cog')
->url(route('filament.admin.settings.index')),
];
}
3. Check Navigation Placement
- The array you return in
getNavigation()defines the exact sidebar order, top-to-bottom. - Don’t use
->sort()or priorities if you want manual control; just set the order in the array. - If “Settings” should always be at the bottom, you can consider using Filament’s sticky sidebar features, but for most cases, just place the item last in the return array.
4. Double-Check Routes and URLs
Make sure route('filament.admin.*') matches your named routes. Adjust as necessary for your app.
Summary:
Place and group the items explicitly in the order you want within the getNavigation() method in your PanelProvider, and disable auto-registration for Resources you want to control manually.
If you follow the above pattern, your Filament admin sidebar will render exactly as you described:
- Dashboard (single item)
- Properties (group: Units, Tenants)
- Settings (single item at the bottom)
Let me know if you need help with adjusting the URLs or if any sidebar item isn’t showing!