Skip to main content
You are currently viewing the documentation for Filament 4.x, which is a previous version of Filament.Looking for the current stable version? Visit the 5.x documentation.

Introduction

Icon entries render an icon representing the state of the entry:
use Filament\Infolists\Components\IconEntry;
use Filament\Support\Icons\Heroicon;

IconEntry::make('status')
    ->icon(fn (string $state): Heroicon => match ($state) {
        'draft' => Heroicon::OutlinedPencil,
        'reviewing' => Heroicon::OutlinedClock,
        'published' => Heroicon::OutlinedCheckCircle,
    })

Customizing the color

You may change the color of the icon, using the color() method:
use Filament\Infolists\Components\IconEntry;

IconEntry::make('status')
    ->color('success')
By passing a function to color(), you can customize the color based on the state of the entry:
use Filament\Infolists\Components\IconEntry;

IconEntry::make('status')
    ->color(fn (string $state): string => match ($state) {
        'draft' => 'info',
        'reviewing' => 'warning',
        'published' => 'success',
        default => 'gray',
    })

Customizing the size

The default icon size is IconSize::Large, but you may customize the size to be either IconSize::ExtraSmall, IconSize::Small, IconSize::Medium, IconSize::ExtraLarge or IconSize::TwoExtraLarge:
use Filament\Infolists\Components\IconEntry;
use Filament\Support\Enums\IconSize;

IconEntry::make('status')
    ->size(IconSize::Medium)

Handling booleans

Icon entries can display a check or “X” icon based on the state of the entry, either true or false, using the boolean() method:
use Filament\Infolists\Components\IconEntry;

IconEntry::make('is_featured')
    ->boolean()
If this attribute in the model class is already cast as a bool or boolean, Filament is able to detect this, and you do not need to use boolean() manually.
Optionally, you may pass a boolean value to control if the icon should be boolean or not:
use Filament\Infolists\Components\IconEntry;

IconEntry::make('is_featured')
    ->boolean(FeatureFlag::active())

Customizing the boolean icons

You may customize the icon representing each state:
use Filament\Infolists\Components\IconEntry;
use Filament\Support\Icons\Heroicon;

IconEntry::make('is_featured')
    ->boolean()
    ->trueIcon(Heroicon::OutlinedCheckBadge)
    ->falseIcon(Heroicon::OutlinedXMark)

Customizing the boolean colors

You may customize the icon color representing each state:
use Filament\Infolists\Components\IconEntry;

IconEntry::make('is_featured')
    ->boolean()
    ->trueColor('info')
    ->falseColor('warning')