F
Filament12mo ago
d3v1anX

NavigationItem group is visible even if no item is visible

Hey there, according to https://beta.filamentphp.com/docs/3.x/panels/navigation#registering-custom-navigation-items the group is visible, even if the conditionally hide is true for all items. Is there any chance to hide the group as well?
use Filament\Navigation\NavigationItem;
use Filament\Panel;

public function panel(Panel $panel): Panel
{
return $panel
// ...
->navigationItems([
NavigationItem::make('Analytics')
->url('https://filament.pirsch.io', shouldOpenInNewTab: true)
->icon('heroicon-o-presentation-chart-line')
->group('Reports')
->sort(3)
->visible(false),
// ...
]);
}
use Filament\Navigation\NavigationItem;
use Filament\Panel;

public function panel(Panel $panel): Panel
{
return $panel
// ...
->navigationItems([
NavigationItem::make('Analytics')
->url('https://filament.pirsch.io', shouldOpenInNewTab: true)
->icon('heroicon-o-presentation-chart-line')
->group('Reports')
->sort(3)
->visible(false),
// ...
]);
}
1 Reply
Patrick Boivin
Patrick Boivin12mo ago
Just had a quick look in the source code. I think you're right, the NavigationGroup is not currently taking this into account. It would a cool PR if you have some time! https://github.com/filamentphp/filament/blob/3.x/packages/panels/resources/views/components/sidebar/group.blade.php