© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
5 replies
Jérôme

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'),
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?

Thx
Solution
OR this
->badge('2', color: 'gray')
->badge('2', color: 'gray')
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

CUSTOM COLOR ON BADGE
FilamentFFilament / ❓┊help
2y ago
badge color from color field
FilamentFFilament / ❓┊help
2y ago
Badge color on minimal theme missing
FilamentFFilament / ❓┊help
2y ago