Web · Components
EmptyState
Placeholder area shown when there is no data to show: empty list, a search with no results, an error, no connection, no permission.
5 exports
Live example
Preview
Nothing here yet
Code
Events
- Events appear here when you interact with the preview.
Import
Placeholder area shown when there is no data to show: empty list, a search with no results, an error, no connection, no permission. Icon, title, description and action buttons are given as props.
- With
preset, icon and texts come ready-made (multilingual); change what you want withtitle/description/icon. - Show it when loading has finished and the list is empty; while loading use
Skeleton. - Announced to screen readers as a region (
role="status"), so the user is informed when a search result becomes empty.
Examples
EmptyStatePreset
typePreset: sets the icon, color and (if not given) the title/description text. The texts come from the UIProvider dictionary.
empty: no records yet (first use).search: the search or filter returned no results.error: loading failed.offline: no internet connection.noAccess: no permission.
Appearance.
plain: borderless; inside a page or card.dashed: dashed box; emphasizes that an area is empty (e.g. a drag-and-drop zone, an empty board column).card: card with a solid border.
EmptyStateClassNames
interfaceClasses that can be passed to the inner parts of EmptyState.
| Name | Type | Description |
|---|---|---|
media? | string | Box of the icon or illustration. |
title? | string | Title. |
description? | string | Description. |
actions? | string | Row of action buttons. |
EmptyStateProps
interfaceProps of the EmptyState component.
Extends: Omit<ComponentProps<"div">, "title">
| Name | Type | Default | Description |
|---|---|---|---|
preset? | EmptyStatePreset | "empty" | Preset. See EmptyStatePreset. |
title? | ReactNode | Title. If omitted, the preset's text is used. Hidden with null. | |
description? | ReactNode | Description. If omitted, the preset's text (if any) is used. Hidden with null. | |
icon? | IconProp | null | Icon: a name or an element. If omitted, the preset's icon. Hidden with null. | |
image? | ReactNode | Illustration shown instead of the icon (drawing, <Image>, SVG). If given, the icon is not drawn. | |
action? | ReactNode | Primary action, usually a Button (e.g. "Add product"). | |
secondaryAction? | ReactNode | Secondary action (e.g. a "Read the docs" link). | |
tone? | Tone | Color of the icon box. If omitted, chosen by the preset. | |
variant? | EmptyStateVariant | CustomVariant<"emptyState"> | "plain" | Appearance: built-in (EmptyStateVariant) or a custom appearance added with defineAppearance. If omitted, UIProvider appearance.defaults.emptyState.variant. |
size? | Size | "md" | Size; changes the padding and font size. |
align? | "center" | "start" | "center" | Alignment. |
titleAs? | "h2" | "h3" | "h4" | "p" | "h3" | HTML element of the title; change it to match the page's heading order. |
children? | ReactNode | Extra content shown below the description and above the actions. | |
classNames? | EmptyStateClassNames | Classes added to the inner parts. |