Add an icon to a ->description()
Is there a way to add an icon to a
Filament\Tables\Columns\TextColumn
description()
?
Like the columns in this screenshot.6 Replies
Maybe as an HtmlString combined with Blade::render() for a heroicons component
I tried this, but it just displays the name & email, no icon (also not a bold name):
TextColumn::make('name')
->formatStateUsing(fn (Model $record) => '<b>' . $record->name . '</b>')
->description(function (Model $record) {
return Blade::render(svg('heroicon-o-mail')->toHtml()) . $record->email;
})
->html()
Did you check the HTML code?
<b>
probably doesn't work on it's own without a class. Icon might have width and height of 0Yes I did, this is how the HTML is rendered
Btw.
->html()
probably overwrites ->formatStateUsing()
as it uses it under the hood. Remove that and try returning a new HtmlString()
Thanks! That works