The BadgeColumn is deprecated. Use TextColumn with the badge() method instead.
Migration
To migrate from BadgeColumn to TextColumn:
use Filament\Tables\Columns\BadgeColumn;
BadgeColumn::make('status')
->colors([
'danger' => 'draft',
'warning' => 'reviewing',
'success' => 'published',
])
TextColumn with badges
The TextColumn provides more flexibility with the badge() method:
use Filament\Tables\Columns\TextColumn;
TextColumn::make('status')
->badge()
->color(fn (string $state): string => match ($state) {
'draft' => 'gray',
'reviewing' => 'warning',
'published' => 'success',
'rejected' => 'danger',
})
Adding icons to badges
You can combine badges with icons:
use Filament\Support\Icons\Heroicon;
TextColumn::make('status')
->badge()
->icon(fn (string $state): Heroicon => match ($state) {
'draft' => Heroicon::OutlinedPencil,
'published' => Heroicon::OutlinedCheckCircle,
})
->color(fn (string $state): string => match ($state) {
'draft' => 'gray',
'published' => 'success',
})
Multiple badges
Display multiple badges from an array:
TextColumn::make('tags')
->badge()
->separator(',')
See the Text Column documentation for more details.