navigation badge icon
Hi All,
Is it possible to add a icon to the navigation badge?
I want a icon insted of a number or text so it will show me if there is a timetracker active or not.
public static function getNavigationBadge(): ?string
{
if(static::getModel()::where('stopped_at', null)->wherenot('started_at',null)->count() > 0)
{
//return static::getModel()::where('stopped_at', null)->wherenot('started_at',null)->count();
return 'heroicon-m-clock';
}
return null;
}
Thanks for your help on this one!
8 Replies
Did you solve the issue?
@Anish Nope, did not solve this.
Try
Basically you can’t just pass in an icon string and expect it to output the icon if it’s not getting parsed into an icon.
@awcodes i don't think it is possible. it will only accept strings en returns the HTML string from blade
https://github.com/filamentphp/filament/blob/3.x/packages/panels/resources/views/components/sidebar/item.blade.php
The badge is escaped.
{!! $badge !!}
will work and I think you could send a PR.GitHub
filament/packages/panels/resources/views/components/sidebar/item.bl...
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS. - filamentphp/filament
Can this blade view be published and extended in the project?
It can. But you should be careful with publishing views as soon as there are updates
Yes, of course!