Documentation Index
Fetch the complete documentation index at: https://mintlify.com/filamentphp/filament/llms.txt
Use this file to discover all available pages before exploring further.
Introduction
Badge entries display text with a colored background, making them perfect for statuses, tags, and categories. Badges are created using the badge() method on TextEntry.
use Filament\Infolists\Components\TextEntry;
TextEntry::make('status')
->badge()
Available Methods
Badge entries use the TextEntry component with the badge() modifier. All TextEntry methods are available.
Badge Configuration
Enable badge display mode.TextEntry::make('status')
->badge()
Set the badge color. Works with Filament’s color system.TextEntry::make('status')
->badge()
->color(fn (string $state): string => match ($state) {
'draft' => 'gray',
'reviewing' => 'warning',
'published' => 'success',
'rejected' => 'danger',
})
Add an icon to the badge.use Filament\Support\Icons\Heroicon;
TextEntry::make('status')
->badge()
->icon(fn (string $state): string => match ($state) {
'published' => Heroicon::OutlinedCheckCircle,
'draft' => Heroicon::OutlinedPencil,
})
Set the icon position within the badge.use Filament\Support\Enums\IconPosition;
TextEntry::make('status')
->badge()
->icon(Heroicon::OutlinedCheckCircle)
->iconPosition(IconPosition::After)
Set the badge size.use Filament\Support\Enums\TextSize;
TextEntry::make('status')
->badge()
->size(TextSize::Large)
Multiple Badges
Split a single value into multiple badges using a separator.TextEntry::make('tags')
->badge()
->separator(',')
Display multiple badge values with line breaks.TextEntry::make('categories.name')
->badge()
->listWithLineBreaks()
Limit the number of badges displayed.TextEntry::make('tags')
->badge()
->separator(',')
->limitList(3)
All TextEntry formatting methods work with badges:
Format badge text with a custom closure.TextEntry::make('status')
->badge()
->formatStateUsing(fn (string $state): string => strtoupper($state))
Examples
Status Badge
TextEntry::make('status')
->badge()
->color(fn (string $state): string => match ($state) {
'pending' => 'gray',
'processing' => 'warning',
'completed' => 'success',
'cancelled' => 'danger',
})
->formatStateUsing(fn (string $state): string => ucfirst($state))
TextEntry::make('tags')
->badge()
->separator(',')
->color(fn (string $state): string => match ($state) {
'featured' => 'warning',
'new' => 'success',
'sale' => 'danger',
default => 'primary',
})
Category Badges
TextEntry::make('categories.name')
->badge()
->color('primary')
->limitList(3)
Priority Badge
use Filament\Support\Icons\Heroicon;
TextEntry::make('priority')
->badge()
->color(fn (string $state): string => match ($state) {
'low' => 'gray',
'medium' => 'primary',
'high' => 'warning',
'urgent' => 'danger',
})
->icon(fn (string $state): string => match ($state) {
'low' => Heroicon::OutlinedArrowDown,
'medium' => Heroicon::OutlinedMinus,
'high' => Heroicon::OutlinedArrowUp,
'urgent' => Heroicon::OutlinedExclamationTriangle,
})
->formatStateUsing(fn (string $state): string => strtoupper($state))
User Roles
TextEntry::make('roles.name')
->badge()
->color(fn (string $state): string => match ($state) {
'admin' => 'danger',
'editor' => 'warning',
'author' => 'success',
'subscriber' => 'gray',
default => 'primary',
})
TextEntry::make('skills')
->badge()
->separator(',')
->color('primary')
->limitList(5)
->listWithLineBreaks()
Verification Badge
use Filament\Support\Icons\Heroicon;
TextEntry::make('email_verified')
->badge()
->color('success')
->icon(Heroicon::OutlinedCheckBadge)
->formatStateUsing(fn (): string => 'Verified')
->visible(fn ($record): bool => $record->email_verified_at !== null)