F
Filament12mo ago
Fally

IconEntry not showing icon if value is null

I have an IconEntry that I want to use to display if something is ok or not. But if the value is null, it doesn't show up. Here's a code example:
IconEntry::make('apple_id')
->label('Apple login')
->icon(fn (string $state): string => !empty($state) ? 'heroicon-o-check-circle' : 'heroicon-o-x-circle')
->color(fn (string $state): string => !empty($state) ? 'success' : 'danger'),
IconEntry::make('apple_id')
->label('Apple login')
->icon(fn (string $state): string => !empty($state) ? 'heroicon-o-check-circle' : 'heroicon-o-x-circle')
->color(fn (string $state): string => !empty($state) ? 'success' : 'danger'),
If it's null I want it to display the red x mark but it just isn't processed. Any workaround?
1 Reply
Sebastián
Sebastián11mo ago
did you solve this?
Want results from more Discord servers?
Add your server