Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m14s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m12s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m7s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m19s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m32s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m22s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 1m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m35s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m7s
- Laravel 13 mit Filament 5 (Admin), Inertia 3 + Vue 3 + Vuetify 4 (Material 3) - Anmeldung über Fortify (Login, Passwort vergessen/ändern), keine Selbstregistrierung - Profil mit Profilbild (WebP in festen Größen), Personenseiten, Header mit Avatar-Menü - Material-3-Farbschema aus der Primärfarbe, hell/dunkel/System pro Person - Basis-Branding (Portalname, Logo, Primärfarbe) im Admin unter „Erscheinungsbild“ - Benutzerverwaltung im Admin, Zugang vorläufig über is_admin - vendor/ (ohne Dev-Pakete) und Frontend-Build mitversioniert, Dev-Pakete in vendor-dev/ - PHPUnit-Tests gegen MySQL/MariaDB, Forgejo-CI-Matrix, Docker-Entwicklungsumgebung - VERSION, CHANGELOG.md und CONTRIBUTING.md mit Release-Ablauf Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
76 lines
3.3 KiB
Markdown
76 lines
3.3 KiB
Markdown
---
|
|
title: Empty states
|
|
---
|
|
import AutoScreenshot from "@components/AutoScreenshot.astro"
|
|
import UtilityInjection from "@components/UtilityInjection.astro"
|
|
|
|
## 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()`](#adding-an-icon-to-the-empty-state) and [`footer()`](#inserting-actions-and-other-components-in-the-footer-of-an-empty-state):
|
|
|
|
```php
|
|
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),
|
|
])
|
|
```
|
|
|
|
<UtilityInjection set="schemaComponents" version="5.x">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.</UtilityInjection>
|
|
|
|
<AutoScreenshot name="schemas/layout/empty-state/simple" alt="Empty state" version="5.x" />
|
|
|
|
## Adding an icon to the empty state
|
|
|
|
You may add an [icon](../styling/icons) to the empty state using the `icon()` method:
|
|
|
|
```php
|
|
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)
|
|
```
|
|
|
|
<UtilityInjection set="schemaComponents" version="5.x">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.</UtilityInjection>
|
|
|
|
## Inserting actions and other components in the footer of an empty state
|
|
|
|
You may insert [actions](../actions) and any other schema component (usually [prime components](primes)) into the footer of an empty state by passing an array of components to the `footer()` method:
|
|
|
|
```php
|
|
use Filament\Actions\Action;
|
|
use Filament\Schemas\Components\EmptyState;
|
|
|
|
EmptyState::make('No users yet')
|
|
->description('Get started by creating a new user.')
|
|
->footer([
|
|
Action::make('createUser')
|
|
->icon(Heroicon::Plus),
|
|
])
|
|
```
|
|
|
|
<UtilityInjection set="schemaComponents" version="5.x">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.</UtilityInjection>
|
|
|
|
## 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)`:
|
|
|
|
```php
|
|
use Filament\Schemas\Components\EmptyState;
|
|
|
|
EmptyState::make('No users yet')
|
|
->description('Get started by creating a new user.')
|
|
->contained(false)
|
|
```
|
|
|
|
<UtilityInjection set="schemaComponents" version="5.x">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.</UtilityInjection>
|
|
|
|
<AutoScreenshot name="schemas/layout/empty-state/contained-false" alt="Empty state without container" version="5.x" />
|