F
Filament2y ago
Veur

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
Dennis Koch
Dennis Koch2y ago
Maybe as an HtmlString combined with Blade::render() for a heroicons component
Veur
VeurOP2y ago
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()
Dennis Koch
Dennis Koch2y ago
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 0
Veur
VeurOP2y ago
Yes I did, this is how the HTML is rendered
Dennis Koch
Dennis Koch2y ago
Btw. ->html() probably overwrites ->formatStateUsing() as it uses it under the hood. Remove that and try returning a new HtmlString()
Veur
VeurOP2y ago
Thanks! That works
Want results from more Discord servers?
Add your server