Change badge color on NavigationItem in AdminPanelProdiver
Hi!
I added a few direct links to my tabs in the navigation items by using the navigationItems function inside the provider
Here is my current code :
NavigationItem::make('document')
->group('Suivi des événements')
->icon('heroicon-o-document')
->sort(21)
->badge(function (): ?int {
$count = EventResource::getEloquentQuery()->where('type', 'document')->where('is_new', true)->count();
return $count > 0 ? $count : null;
})
->label(fn(): string => __('Documents'))
->url(fn(): string => EventResource::getUrl() . '?activeTab=document')
->isActiveWhen(fn() => request()->routeIs('filament.admin.resources.events.*') && request()->input('activeTab') === 'document'),
I don't find out to change the badge color. There is a badge function and a badgeTooltip function but I can't find a badgeColor.
Is that possible to specity from here?
Thx3 Replies
getNavigationBadgeColor()
https://filamentphp.com/docs/3.x/panels/navigation#adding-a-badge-to-a-navigation-itemSolution
OR this
->badge('2', color: 'gray')
ah yes it works at at the param of badge... thx @Vp 🙂