Skip to content
Version 4.x
Theme

Empty states

View as Markdown

On this page

#Introduction

You can display an empty state in your schema to communicate that there is no content to show yet, and to guide the user towards the next action. An empty state requires a heading, but can also have a description(), icon() and footer():

use Filament\Actions\Action;
use Filament\Schemas\Components\EmptyState;
use Filament\Support\Icons\Heroicon;

EmptyState::make('No users yet')
    ->description('Get started by creating a new user.')
    ->icon(Heroicon::OutlinedUser)
    ->footer([
        Action::make('createUser')
            ->icon(Heroicon::Plus),
    ])

As well as allowing static values, the make() and description() methods also accept functions to dynamically calculate them. You can inject various utilities into the function as parameters.

Component $component Filament\Schemas\Components\Component

The current component instance.

Get function $get Filament\Schemas\Components\Utilities\Get

A function for retrieving values from the current schema data. Validation is not run on form fields.

Livewire $livewire Livewire\Component

The Livewire component instance.

Eloquent model FQN $model ?string<Illuminate\Database\Eloquent\Model>

The Eloquent model FQN for the current schema.

Operation $operation string

The current operation being performed by the schema. Usually create, edit, or view.

Parent repeater item index $parentRepeaterItemIndex int

The zero-based index of the nearest containing repeater item or builder block, or 0 when neither exists.

Record $record Illuminate\Database\Eloquent\Model|array<string, mixed>|null

The Eloquent record or custom data array for the current schema.

Empty state

#Adding an icon to the empty state

You may add an icon to the empty state using the icon() method:

use Filament\Schemas\Components\EmptyState;
use Filament\Support\Icons\Heroicon;

EmptyState::make('No users yet')
    ->description('Get started by creating a new user.')
    ->icon(Heroicon::OutlinedUser)

As well as allowing a static value, the icon() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.

Component $component Filament\Schemas\Components\Component

The current component instance.

Get function $get Filament\Schemas\Components\Utilities\Get

A function for retrieving values from the current schema data. Validation is not run on form fields.

Livewire $livewire Livewire\Component

The Livewire component instance.

Eloquent model FQN $model ?string<Illuminate\Database\Eloquent\Model>

The Eloquent model FQN for the current schema.

Operation $operation string

The current operation being performed by the schema. Usually create, edit, or view.

Parent repeater item index $parentRepeaterItemIndex int

The zero-based index of the nearest containing repeater item or builder block, or 0 when neither exists.

Record $record Illuminate\Database\Eloquent\Model|array<string, mixed>|null

The Eloquent record or custom data array for the current schema.

You may insert actions and any other schema component (usually prime components) into the footer of an empty state by passing an array of components to the footer() method:

use Filament\Actions\Action;
use Filament\Schemas\Components\EmptyState;
use Filament\Support\Icons\Heroicon;

EmptyState::make('No users yet')
    ->description('Get started by creating a new user.')
    ->footer([
        Action::make('createUser')
            ->icon(Heroicon::Plus),
    ])

As well as allowing a static value, the footer() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.

Component $component Filament\Schemas\Components\Component

The current component instance.

Get function $get Filament\Schemas\Components\Utilities\Get

A function for retrieving values from the current schema data. Validation is not run on form fields.

Livewire $livewire Livewire\Component

The Livewire component instance.

Eloquent model FQN $model ?string<Illuminate\Database\Eloquent\Model>

The Eloquent model FQN for the current schema.

Operation $operation string

The current operation being performed by the schema. Usually create, edit, or view.

Parent repeater item index $parentRepeaterItemIndex int

The zero-based index of the nearest containing repeater item or builder block, or 0 when neither exists.

Record $record Illuminate\Database\Eloquent\Model|array<string, mixed>|null

The Eloquent record or custom data array for the current schema.

#Removing the empty state container

By default, empty states have a background color, shadow and border. You may remove these styles and just render the content of the empty state without the container using contained(false):

use Filament\Schemas\Components\EmptyState;

EmptyState::make('No users yet')
    ->description('Get started by creating a new user.')
    ->contained(false)

As well as allowing a static value, the contained() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.

Component $component Filament\Schemas\Components\Component

The current component instance.

Get function $get Filament\Schemas\Components\Utilities\Get

A function for retrieving values from the current schema data. Validation is not run on form fields.

Livewire $livewire Livewire\Component

The Livewire component instance.

Eloquent model FQN $model ?string<Illuminate\Database\Eloquent\Model>

The Eloquent model FQN for the current schema.

Operation $operation string

The current operation being performed by the schema. Usually create, edit, or view.

Parent repeater item index $parentRepeaterItemIndex int

The zero-based index of the nearest containing repeater item or builder block, or 0 when neither exists.

Record $record Illuminate\Database\Eloquent\Model|array<string, mixed>|null

The Eloquent record or custom data array for the current schema.

Empty state without container
Documentation menu Star on GitHub