© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•14mo ago•
4 replies
ruskan

How can I render the badge with only the icon (no text)?

Tables\Columns\TextColumn::make('transaction.state')
                    ->label('State')
                    ->badge()
                    ->color(fn (string $state): string => match ($state) {
                        'created' => 'info',
                        'pending' => 'info',
                        'completed' => 'success',
                        'declined' => 'danger',
                        'failed' => 'danger',
                        'reverted' => 'info',
                    })
                    ->icon(fn (string $state): string => match ($state) {
                        'created' => 'heroicon-o-clock',
                        'pending' => 'heroicon-o-clock',
                        'completed' => 'heroicon-o-check',
                        'declined' => 'heroicon-o-x',
                        'failed' => 'heroicon-o-x',
                        'reverted' => 'heroicon-o-arrow-path',
                    })
                    ->formatStateUsing(fn (string $state): string => '')
Tables\Columns\TextColumn::make('transaction.state')
                    ->label('State')
                    ->badge()
                    ->color(fn (string $state): string => match ($state) {
                        'created' => 'info',
                        'pending' => 'info',
                        'completed' => 'success',
                        'declined' => 'danger',
                        'failed' => 'danger',
                        'reverted' => 'info',
                    })
                    ->icon(fn (string $state): string => match ($state) {
                        'created' => 'heroicon-o-clock',
                        'pending' => 'heroicon-o-clock',
                        'completed' => 'heroicon-o-check',
                        'declined' => 'heroicon-o-x',
                        'failed' => 'heroicon-o-x',
                        'reverted' => 'heroicon-o-arrow-path',
                    })
                    ->formatStateUsing(fn (string $state): string => '')

If I set the state value to '', the badge disappears completely. Is there any way to force it to be visible (->visible() didn't work i tried)?
Solution
why not IconColumn ?
Icon column - Table Builder - Filament
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

How can I change the badge text in a textEntry?
FilamentFFilament / ❓┊help
3y ago
Enum TextColumn badge() with label, icon and color
FilamentFFilament / ❓┊help
3y ago
navigation badge icon
FilamentFFilament / ❓┊help
3y ago
Animate Notification Badge \ icon
FilamentFFilament / ❓┊help
14mo ago