Conditionally rendering an icon in TextColumn

I have a situation where the value of a cell could be "true" or anything else. How can I render an icon instead of text in a TextColumn, I tried this but it didn't work:
Tables\Columns\TextColumn::make('value')
    ->formatStateUsing( fn($state) => $state === 'true' ? new HtmlString(Blade::render('<x-filament::icon icon="heroicon-o-check" class="w-4 h-4"/>')) : $state ),


Thanks!
Solution
ahh ok. Use TextColumn::make('value')->icon(fn($record) => $record->value === 'true' ? 'heroicon-o-check' : null)
Was this page helpful?