F
Filamentβ€’16mo ago
Hai NGUYEN

cannot show icon

cannot show icon
9 Replies
torriv
torrivβ€’16mo ago
try:
Tables\Columns\IconColumn::make('email_verified_at')
->boolean()
->trueIcon('heroicon-o-clock')
->falseIcon('heroicon-o-check-circle'),
Tables\Columns\IconColumn::make('email_verified_at')
->boolean()
->trueIcon('heroicon-o-clock')
->falseIcon('heroicon-o-check-circle'),
meeglos
meeglosβ€’16mo ago
Did the answer solve your issue?
Mazz
Mazzβ€’16mo ago
I have the same issue
IconColumn::make('External')
->icon(fn(string $state): string => match ($state) {
'draft' => 'heroicon-o-pencil',
'reviewing' => 'heroicon-o-clock',
'published' => 'heroicon-o-check-circle',
default => 'heroicon-o-pencil',
})
->label('Link'),
IconColumn::make('External')
->icon(fn(string $state): string => match ($state) {
'draft' => 'heroicon-o-pencil',
'reviewing' => 'heroicon-o-clock',
'published' => 'heroicon-o-check-circle',
default => 'heroicon-o-pencil',
})
->label('Link'),
Tried with this code. Note - the External column does not exists. Worked in 2.x @hainguyen8610 i solved it by setting a State. Since External does not exist it might be an issue if it is null
IconColumn::make('external')
->icon('heroicon-o-arrow-top-right-on-square')
->state('random')
->label('Link'),
IconColumn::make('external')
->icon('heroicon-o-arrow-top-right-on-square')
->state('random')
->label('Link'),
But it seems if we have null values the Column doesn't render at all
Dennis Koch
Dennis Kochβ€’16mo ago
That's correct
Mazz
Mazzβ€’16mo ago
Is this a desired behaviour? Because in my case i'd like to render a Icon or Badges if the value is null. Tried with ->state(null) and ->default(null) but with the same outcome. If desired: How could i let this render?
Dennis Koch
Dennis Kochβ€’16mo ago
I guess it is. I hit the same issue already. I think I mapped null state to some unused value like -1 @Dan Harrin Any reason we filter null values in table columns? As sometimes it's desired to format null as a placeholder or fallback icon?
Dan Harrin
Dan Harrinβ€’16mo ago
imagine this
IconColumn::make('email_verified_at')
->icon('heroicon-o-check')
IconColumn::make('email_verified_at')
->icon('heroicon-o-check')
maybe someone should add placeholderIcon() to the icon column where you can pass in an icon for the null state
Dennis Koch
Dennis Kochβ€’16mo ago
Not sure. You expcet this to show an icon when the value is not null? I think this query should be formatted or at least cast to a bool inside getStateUsing()
Arnaud
Arnaudβ€’12mo ago
Hello, if it could helps, juste use default : ->default(false). In my case :

IconColumn::make('calendar_id')
->label('With meeting ?')
->boolean()
->icon('heroicon-o-calendar')
->default(false)
->falseColor('gray'),

IconColumn::make('calendar_id')
->label('With meeting ?')
->boolean()
->icon('heroicon-o-calendar')
->default(false)
->falseColor('gray'),
Also works with column relationship exists πŸ™‚
Want results from more Discord servers?
Add your server