Empty state Overview

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.

When to Use

✅ 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
Examples Basic empty state

Set the heading with the heading attribute and put the supporting text in the default slot:

Documents you upload or receive from an authority appear here.
With an icon

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:

Documents you upload or receive from an authority appear here.
With actions

Put buttons or links in the actions slot. They sit below the text and wrap on narrow screens:

Documents you upload or receive from an authority appear here. Upload a document Learn more
Heading level

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:

Check the spelling, or try a shorter search term or fewer filters. Clear filters
Empty slots

Slots you leave empty take no space. An empty state with only a heading has no gap for a missing icon, text or actions:

Custom Styling

Use CSS custom properties to change spacing, alignment and colors, and the base, icon, heading, description and actions parts for anything else.

New messages from authorities appear here.
Accessibility
  • Heading: the heading is a real HTML heading, so screen reader users can find the empty state by navigating headings. Choose headingLevel to match the surrounding outline.
  • Decorative icon: the icon slot 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 actions slot keep their own names, roles and keyboard behavior. Give them labels that make sense on their own.
Importing Per-component import (Recommended)

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 everything

Register the whole library at once — convenient, but pulls every component into your bundle:

import 'dap-design-system'
Importing React
import { DapDSEmptyStateReact } from 'dap-design-system/react'
Attributes
PropertyTypeDefaultDescription
headingstringThe heading of the empty state.
headingLevel1, 2 , 3 , 4 , 5 , 63The 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.
ariaLabelstring, nullnullAccessible label for the element. Use this to provide a text alternative
for elements that don't have visible text content.
ariaExpanded'true', 'false'nullIndicates whether the element is expanded or collapsed.
ariaControlsstring, nullnullIdentifies the element that is controlled by this element.
ariaHasPopupstring, nullnullIndicates the availability and type of interactive popup element.
ariaDescribedBystring, nullnullIdentifies the element that describes the current element.
ariaPressed'true', 'false' , 'mixed'nullIndicates the current "pressed" state of toggle buttons.
ariaHidden'true', 'false'nullIndicates whether the element is hidden from accessibility APIs.
customStylesstring, undefinedCustom 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.
Slots
NameDescription
(default)The supporting text of the empty state.
iconA decorative icon or illustration, sized by the caller. It is hidden from assistive technology, so keep all meaning in the heading and text.
actionsThe next actions, such as buttons or links.
Events

No custom events available.

CSS Parts
Part NameDescription
baseThe main empty state container.
iconThe wrapper of the icon slot.
headingThe heading of the empty state.
descriptionThe wrapper of the supporting text.
actionsThe wrapper of the actions slot.
How to Use CSS Parts

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.

CSS Custom Properties
Property NameDescription
--dds-empty-state-paddingPadding of the empty state container. (default: var(--dds-spacing-600))
--dds-empty-state-gapGap between the icon, the text group and the actions. (default: var(--dds-spacing-400))
--dds-empty-state-text-gapGap between the heading and the supporting text. (default: var(--dds-spacing-200))
--dds-empty-state-actions-gapGap between action items. (default: var(--dds-spacing-300))
--dds-empty-state-max-widthMaximum width of the content. (default: 40rem)
--dds-empty-state-text-alignText alignment of the content. (default: center)
--dds-empty-state-icon-colorColor of the icon. (default: var(--dds-icon-neutral-subtle))
--dds-empty-state-heading-colorColor of the heading. (default: var(--dds-text-neutral-strong))
--dds-empty-state-heading-font-sizeFont size of the heading. (default: var(--dds-font-lg))
--dds-empty-state-heading-font-weightFont weight of the heading. (default: var(--dds-font-weight-bold))
--dds-empty-state-description-colorColor of the supporting text. (default: var(--dds-text-neutral-base))
--dds-empty-state-description-font-sizeFont size of the supporting text. (default: var(--dds-font-base))
How to Use CSS Custom Properties

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.