The root container for an empty state component.
import { EmptyState } from '@wordpress/ui';
LinksPermalink to this section
PropsPermalink to this section
| Name | Default | Description |
|---|---|---|
children |
The content to be rendered inside the component. | |
className |
CSS class name to apply to the element. | |
style |
CSS style to apply to the element. | |
render |
Replaces the component’s default HTML element using a given React element, or a function that returns a React element. |
ExamplesPermalink to this section
DefaultPermalink to this section
const Default = () => <EmptyState.Root>{[
<EmptyState.Icon icon={ search } key="icon" />,
<EmptyState.Title key="title">No results found</EmptyState.Title>,
<EmptyState.Description key="description">
Try adjusting your search or filter to find what you're
looking for.
</EmptyState.Description>,
<EmptyState.Actions key="actions">
<Button variant="outline">Clear filters</Button>
<Button>Add item</Button>
</EmptyState.Actions>,
]}</EmptyState.Root>;
With Custom VisualPermalink to this section
const WithCustomVisual = () => <EmptyState.Root>{[
<EmptyState.Visual key="visual">
<svg
width="50"
height="50"
viewBox="0 0 50 50"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<circle cx="25" cy="25" r="25" fill="currentColor" />
</svg>
</EmptyState.Visual>,
<EmptyState.Title key="title">All caught up!</EmptyState.Title>,
<EmptyState.Description key="description">
You've completed all your tasks. Great work!
</EmptyState.Description>,
<EmptyState.Actions key="actions">
<Button>Create new task</Button>
</EmptyState.Actions>,
]}</EmptyState.Root>;