Skip to main content

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

badge()
bool|Closure
Enable badge display mode.
TextEntry::make('status')
    ->badge()
color()
string|array|Closure
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',
    })
icon()
string|Htmlable|Closure
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,
    })
iconPosition()
IconPosition
Set the icon position within the badge.
use Filament\Support\Enums\IconPosition;

TextEntry::make('status')
    ->badge()
    ->icon(Heroicon::OutlinedCheckCircle)
    ->iconPosition(IconPosition::After)
size()
TextSize
Set the badge size.
use Filament\Support\Enums\TextSize;

TextEntry::make('status')
    ->badge()
    ->size(TextSize::Large)

Multiple Badges

separator()
string|Closure
Split a single value into multiple badges using a separator.
TextEntry::make('tags')
    ->badge()
    ->separator(',')
listWithLineBreaks()
bool|Closure
Display multiple badge values with line breaks.
TextEntry::make('categories.name')
    ->badge()
    ->listWithLineBreaks()
limitList()
int|Closure
Limit the number of badges displayed.
TextEntry::make('tags')
    ->badge()
    ->separator(',')
    ->limitList(3)

Formatting

All TextEntry formatting methods work with badges:
formatStateUsing()
Closure
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))

Tags with Color Coding

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',
    })

Skill Tags

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)

Build docs developers (and LLMs) love