Add a badge next to the title of my View page

I have a PackageResource that is using an InfoList and a ViewPackage page. My packages have a status column. I am able to display the status in the body of the InfoList as a badge but I would like to display it next to the title of the page instead. Is this possible?
2 Replies
LeandroFerreira
LeandroFerreira4mo ago
something like this in your ViewPackage page?
public function getTitle(): string|Htmlable
{
$title = parent::getTitle();
$customTitle = <<<BLADE
<div class="flex gap-2">
$title
<div>
<x-filament::badge>New</x-filament::badge>
</div>
</div>
BLADE;

return new HtmlString(Blade::render($customTitle));
}
public function getTitle(): string|Htmlable
{
$title = parent::getTitle();
$customTitle = <<<BLADE
<div class="flex gap-2">
$title
<div>
<x-filament::badge>New</x-filament::badge>
</div>
</div>
BLADE;

return new HtmlString(Blade::render($customTitle));
}
DerekCaswell
DerekCaswellOP3mo ago
I'm a little surprised that this isn't a common enough thing that there would be a built-in way of doing it. Thanks for the info!
Want results from more Discord servers?
Add your server