Empty State
The EmptyState component provides a visual placeholder for when data is missing or a user hasn't completed an action yet. It usually contains an icon, a title, a description, and a call-to-action button.
Quick Start
No items found
You haven't added any items to your collection yet.
Visual Examples & Use Cases
1. Dashboard Placeholders
Use inside cards or grids to signify empty data sets.
Code & Output
```python from faststrap import Card
No Activity
Log some activity to see it here.
```
Parameter Reference
| FastStrap Param | Type | Description |
|---|---|---|
title |
str |
Main bold heading. |
description |
str |
Explanatory message. |
icon |
str |
Bootstrap icon name. |
action |
Any |
Call to action (usually a Button or Link). |
variant |
str |
Color variant for the icon and title. |
faststrap.components.display.empty_state.EmptyState(icon=None, title='No data available', description=None, action=None, centered=True, icon_cls='display-4 text-muted mb-3', title_cls='mb-2', description_cls='text-muted mb-4', **kwargs)
Bootstrap Empty State component.
Placeholder for empty data states.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
icon
|
Any | None
|
Icon component or img to display |
None
|
title
|
str
|
Main heading |
'No data available'
|
description
|
str | None
|
Subtitle/explanation |
None
|
action
|
Any | None
|
Button or link to perform an action |
None
|
centered
|
bool
|
Center align content (default: True) |
True
|
icon_cls
|
str
|
Classes for the icon wrapper |
'display-4 text-muted mb-3'
|
title_cls
|
str
|
Classes for title |
'mb-2'
|
description_cls
|
str
|
Classes for description |
'text-muted mb-4'
|
**kwargs
|
Any
|
Additional HTML attributes |
{}
|
Returns:
| Type | Description |
|---|---|
Div
|
FastHTML Div element |
Example
EmptyState( ... Icon("inbox", cls="display-1"), ... title="No messages", ... description="Your inbox is empty.", ... action=Button("Refresh") ... )