Overview
By default, Filament will register navigation items for each of your resources, custom pages, and clusters. These classes contain static properties and methods that you can override, to configure that navigation item. If you’re looking to add a second layer of navigation to your app, you can use clusters. These are useful for grouping resources and pages together.Customizing a navigation item’s label
By default, the navigation label is generated from the resource or page’s name. You may customize this using the$navigationLabel property:
getNavigationLabel() method:
Customizing a navigation item’s icon
To customize a navigation item’s icon, you may override the$navigationIcon property on the resource or page class:
$navigationIcon = null on all items within the same navigation group, those items will be joined with a vertical bar below the group label.
Switching navigation item icon when it is active
You may assign a navigation icon which will only be used for active items using the$activeNavigationIcon property:
Sorting navigation items
By default, navigation items are sorted alphabetically. You may customize this using the$navigationSort property:
Adding a badge to a navigation item
To add a badge next to the navigation item, you can use thegetNavigationBadge() method and return the content of the badge:
getNavigationBadge(), it will display using the primary color by default. To style the badge contextually, return either danger, gray, info, primary, success or warning from the getNavigationBadgeColor() method:
$navigationBadgeTooltip:
getNavigationBadgeTooltip():
Grouping navigation items
You may group navigation items by specifying a$navigationGroup property on a resource and custom page:
Grouping navigation items under other items
You may group navigation items as children of other items, by passing the label of the parent item as the$navigationParentItem:
getNavigationParentItem() method to set a dynamic parent item label:
If you’re reaching for a third level of navigation like this, you should consider using clusters instead, which are a logical grouping of resources and custom pages, which can share their own separate navigation.
Customizing navigation groups
You may customize navigation groups by callingnavigationGroups() in the configuration, and passing NavigationGroup objects in order:
icon() for the groups, and make one collapsed() by default.
Ordering navigation groups
By usingnavigationGroups(), you are defining a new order for the navigation groups. If you just want to reorder the groups and not define an entire NavigationGroup object, you may just pass the labels of the groups in the new order:
Making navigation groups not collapsible
By default, navigation groups are collapsible. You may disable this behavior by callingcollapsible(false) on the NavigationGroup object:
Adding extra HTML attributes to navigation groups
You can pass extra HTML attributes to the navigation group, which will be merged onto the outer DOM element. Pass an array of attributes to theextraSidebarAttributes() or extraTopbarAttributes() method, where the key is the attribute name and the value is the attribute value:
extraSidebarAttributes() will be applied to navigation group elements contained in the sidebar, and the extraTopbarAttributes() will only be applied to topbar navigation group dropdowns when using top navigation.
Collapsible sidebar on desktop
To make the sidebar collapsible on desktop as well as mobile, you can use the configuration:sidebarFullyCollapsibleOnDesktop() method:
Navigation groups in a collapsible sidebar on desktop
This section only applies toWhen using a collapsible sidebar on desktop, you will also often be using navigation groups. By default, the labels of each navigation group will be hidden when the sidebar is collapsed, since there is no space to display them. Even if the navigation group itself is collapsible, all items will still be visible in the collapsed sidebar, since there is no group label to click on to expand the group. These issues can be solved, to achieve a very minimal sidebar design, by passing ansidebarCollapsibleOnDesktop(), notsidebarFullyCollapsibleOnDesktop(), since the fully collapsible UI just hides the entire sidebar instead of changing its design.
icon() to the navigation group objects. When an icon is defined, the icon will be displayed in the collapsed sidebar instead of the items at all times. When the icon is clicked, a dropdown will open to the side of the icon, revealing the items in the group.
When passing an icon to a navigation group, even if the items also have icons, the expanded sidebar UI will not show the item icons. This is to keep the navigation hierarchy clear, and the design minimal. However, the icons for the items will be shown in the collapsed sidebar’s dropdowns though, since the hierarchy is already clear from the fact that the dropdown is open.
Registering custom navigation items
To register new navigation items, you can use the configuration:Conditionally hiding navigation items
You can also conditionally hide a navigation item by using thevisible() or hidden() methods, passing in a condition to check:
Disabling resource or page navigation items
To prevent resources or pages from showing up in navigation, you may use:shouldRegisterNavigation() method:
Using top navigation
By default, Filament will use a sidebar navigation. You may use a top navigation instead by using the configuration:Customizing the width of the sidebar
You can customize the width of the sidebar by passing it to thesidebarWidth() method in the configuration:
sidebarCollapsibleOnDesktop() method, you can customize width of the collapsed icons by using the collapsedSidebarWidth() method in the configuration:
Advanced navigation customization
Thenavigation() method can be called from the configuration. It allows you to build a custom navigation that overrides Filament’s automatically generated items. This API is designed to give you complete control over the navigation.
Registering custom navigation items
To register navigation items, call theitems() method:
Registering custom navigation groups
If you want to register groups, you can call thegroups() method:
Disabling navigation
You may disable navigation entirely by passingfalse to the navigation() method:
Disabling the topbar
You may disable topbar entirely by passingfalse to the topbar() method:
Customizing the user menu
The user menu is featured in the top right corner of the admin layout. It’s fully customizable. To register new items to the user menu, you can use the configuration:Customizing the profile link
To customize the user profile link at the start of the user menu, register a new item with theprofile array key:
Customizing the logout link
To customize the user logout link at the end of the user menu, register a new item with thelogout array key:
Conditionally hiding user menu items
You can also conditionally hide a user menu item by using thevisible() or hidden() methods, passing in a condition to check. Passing a function will defer condition evaluation until the menu is actually being rendered:
Sending a POST HTTP request from a user menu item
You can send a POST HTTP request from a user menu item by passing a URL to the postAction() method: