F
Filamentβ€’16mo ago
Crylar

Is it possible to hide Badge based on the value?

I have the following code and would love to hide for that row when "children_count" is 0. What are my options? Thanks.
return $table
->columns([
Tables\Columns\TextColumn::make('title'),
Tables\Columns\BadgeColumn::make('children_count')
->label('')
->icon('heroicon-o-tag')
->counts('children')

])
return $table
->columns([
Tables\Columns\TextColumn::make('title'),
Tables\Columns\BadgeColumn::make('children_count')
->label('')
->icon('heroicon-o-tag')
->counts('children')

])
4 Replies
Dennis Koch
Dennis Kochβ€’16mo ago
I guess it's not possible. You could try formatStateUsing() but that will probably also show an empty b adge
Crylar
Crylarβ€’16mo ago
It actually worked, thanks @Dennis Koch for pointing to the right direction. πŸ™‚
Dennis Koch
Dennis Kochβ€’16mo ago
Nice.
Crylar
Crylarβ€’16mo ago
when you return null in a state it skips, cool πŸ™‚