An empty state fills a content area that has nothing to show yet, such as a list without items or a search without results. It names the situation with a heading, explains it in a sentence or two, and can offer the next step. An optional icon or illustration adds a visual cue.
The empty state only lays out what you give it. The heading text, the supporting text, the icon and the actions, including what the actions do, all come from your page.
✅ Use an empty state when:
- A list, table or dashboard section has no items yet
- A search or a filter returns no results
- A user has not created or received anything in a section yet
- You want to point the user to the action that fills the area
❌ Don't use an empty state for:
- Loading content (use a spinner or skeleton instead)
- Errors or failed requests (use a callout or feedback message instead)
- Messages that must be announced the moment they appear (the empty state has no live region)
- Explaining something that needs more than a short paragraph
Set the heading with the heading attribute and put the supporting text in the default slot:
Put an icon or illustration in the icon slot. Size it on the icon itself. The icon is decorative and hidden from assistive technology, so the heading and text must carry the whole message:
Put buttons or links in the actions slot. They sit below the text and wrap on narrow screens:
The heading is an h3 by default. Set headingLevel so the heading fits the outline of your page. Numbers outside 1–6 use the nearest level, and a value that is not a number uses the default. The heading looks the same at every level:
Slots you leave empty take no space. An empty state with only a heading has no gap for a missing icon, text or actions:
Use CSS custom properties to change spacing, alignment and colors, and the base, icon, heading, description and actions parts for anything else.
- Heading: the heading is a real HTML heading, so screen reader users can find the empty state by navigating headings. Choose
headingLevelto match the surrounding outline. - Decorative icon: the
iconslot is hidden from assistive technology. Never put meaning only in the icon. - No live region: the empty state does not announce itself and does not move focus. If an empty result appears after a user action, such as a search, announce the outcome from your page, for example with a live region that says how many results were found.
- Actions: the controls you put in the
actionsslot keep their own names, roles and keyboard behavior. Give them labels that make sense on their own.
Import the component by its own subpath. This registers <dap-ds-empty-state> (and the
components it renders internally) and lets your bundler include only what you use:
import 'dap-design-system/components/empty-state'
Need a reference to the class (e.g. to register it manually or extend it)? The same subpath default-exports it:
import DapDSEmptyState from 'dap-design-system/components/empty-state'
Register the whole library at once — convenient, but pulls every component into your bundle:
import 'dap-design-system'
import { DapDSEmptyStateReact } from 'dap-design-system/react'
| Property | Type | Default | Description |
|---|---|---|---|
heading | string | The heading of the empty state. | |
headingLevel | 1, 2 , 3 , 4 , 5 , 6 | 3 | The HTML heading level of the heading, so it fits the page's outline. |
| Numbers outside 1–6 clamp to the nearest level; a non-numeric value uses the default. | |||
ariaLabel | string, null | null | Accessible label for the element. Use this to provide a text alternative |
| for elements that don't have visible text content. | |||
ariaExpanded | 'true', 'false' | null | Indicates whether the element is expanded or collapsed. |
ariaControls | string, null | null | Identifies the element that is controlled by this element. |
ariaHasPopup | string, null | null | Indicates the availability and type of interactive popup element. |
ariaDescribedBy | string, null | null | Identifies the element that describes the current element. |
ariaPressed | 'true', 'false' , 'mixed' | null | Indicates the current "pressed" state of toggle buttons. |
ariaHidden | 'true', 'false' | null | Indicates whether the element is hidden from accessibility APIs. |
customStyles | string, undefined | Custom CSS text to be merged with the component's styles. | |
| This CSS will be injected into the shadow DOM and merged with the component's static styles. |
| Name | Description |
|---|---|
(default) | The supporting text of the empty state. |
icon | A decorative icon or illustration, sized by the caller. It is hidden from assistive technology, so keep all meaning in the heading and text. |
actions | The next actions, such as buttons or links. |
No custom events available.
| Part Name | Description |
|---|---|
base | The main empty state container. |
icon | The wrapper of the icon slot. |
heading | The heading of the empty state. |
description | The wrapper of the supporting text. |
actions | The wrapper of the actions slot. |
You can style CSS parts using the ::part() pseudo-element selector:
/* Target a specific part */
.my-custom-dap-ds-empty-state::part(base) {
/* Your custom styles */
}
/* Target multiple parts */
.my-custom-dap-ds-empty-state::part(base),
.my-custom-dap-ds-empty-state::part(icon) {
/* Shared styles */
}
Example usage:
<dap-ds-empty-state class="my-custom-dap-ds-empty-state">
Empty state
</dap-ds-empty-state>
.my-custom-dap-ds-empty-state::part(base) {
border-radius: 12px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
CSS parts allow you to style internal elements of the component while maintaining encapsulation. Learn more in our styling guide.
| Property Name | Description |
|---|---|
--dds-empty-state-padding | Padding of the empty state container. (default: var(--dds-spacing-600)) |
--dds-empty-state-gap | Gap between the icon, the text group and the actions. (default: var(--dds-spacing-400)) |
--dds-empty-state-text-gap | Gap between the heading and the supporting text. (default: var(--dds-spacing-200)) |
--dds-empty-state-actions-gap | Gap between action items. (default: var(--dds-spacing-300)) |
--dds-empty-state-max-width | Maximum width of the content. (default: 40rem) |
--dds-empty-state-text-align | Text alignment of the content. (default: center) |
--dds-empty-state-icon-color | Color of the icon. (default: var(--dds-icon-neutral-subtle)) |
--dds-empty-state-heading-color | Color of the heading. (default: var(--dds-text-neutral-strong)) |
--dds-empty-state-heading-font-size | Font size of the heading. (default: var(--dds-font-lg)) |
--dds-empty-state-heading-font-weight | Font weight of the heading. (default: var(--dds-font-weight-bold)) |
--dds-empty-state-description-color | Color of the supporting text. (default: var(--dds-text-neutral-base)) |
--dds-empty-state-description-font-size | Font size of the supporting text. (default: var(--dds-font-base)) |
CSS custom properties (CSS variables) can be set directly on the component or in your stylesheet:
Method 1: Inline styles (Quick customization)
<dap-ds-empty-state
style="--dds-empty-state-padding: value; --dds-empty-state-gap: value;">
Empty state
</dap-ds-empty-state>
Method 2: CSS classes (Reusable styles)
.my-custom-dap-ds-empty-state {
--dds-empty-state-padding: value;
--dds-empty-state-gap: value;
--dds-empty-state-text-gap: value;
}
<dap-ds-empty-state class="my-custom-dap-ds-empty-state">
Empty state
</dap-ds-empty-state>
Method 3: Global theme customization
/* Apply to all instances */
dap-ds-empty-state {
--dds-empty-state-padding: value;
--dds-empty-state-gap: value;
}
CSS custom properties inherit through the Shadow DOM, making them perfect for theming. Changes apply immediately without rebuilding.