Skip to content

Empty State

FeedbackSince 0.13.0

Explains why a table, list, search, or page has nothing to show and offers the next step. An empty state has a decorative icon or illustration, a title (a heading at a chosen level, or plain text inside tables and lists), a description, and up to two actions rendered as AbsoluteUI buttons or links. Three sizes fit table cells, panels, and whole pages; with live, a search that matches nothing is announced.

  • Explain and guideA title, a description, and up to two actions that say what to do next.
  • Fits anywhereThree sizes for table cells, panels, and pages; the title can be plain text inside tables.
  • Heading you chooseSet the heading level to fit the page outline, or none at all.
  • Announced when liveWith live, a search that matches nothing is announced politely to screen readers.

Use it for

  • A table or list with no rows yet (first use) or no rows for the current filters.
  • A search with no results.
  • A page or panel waiting for a selection, such as the detail pane of a master-detail layout.

Use something else for

  • Errors that need attention: use Alert or Inline Message.
  • Content that is still loading: use Skeleton or Spinner.
  • Short hints inside a form field: use help text.
Anatomy
<div class="aui-empty-state aui-empty-state--md" role="status"> (role only with live)
<div class="aui-empty-state__media" aria-hidden="true"><svg class="aui-icon">...</svg></div>
<h3 class="aui-empty-state__title">No employees match your filters</h3>
<p class="aui-empty-state__description">Try a different name or clear the filters.</p>
<div class="aui-empty-state__actions">
<button class="aui-button aui-empty-state__primary">Clear filters</button>
<a class="aui-button aui-empty-state__secondary" href="/help">Read the guide</a>
</div>
</div>

Use the bar above each frame to switch theme, density, direction, and locale.

Empty State in the Workspace layout showcase

Section titled “Empty State in the Workspace layout showcase”

The part of the Workspace layout showcase that uses Empty State. Change its options, use it with the keyboard, and watch the event log; the link in the frame opens the full showcase. The bar above the frame switches theme, density, direction, and locale.

Showcase source
// Workspace layout showcase: a splitter with a virtual list of 10,000 employees in the
// sidebar and the selected person's details beside it. Empty states appear when nothing is
// selected and when the department filter matches nobody.
import { EmptyState } from '@absoluteui/components/empty-state';
import { Splitter, type SplitterChangeDetail } from '@absoluteui/components/splitter';
import { VirtualList, type VirtualListChangeDetail, type VirtualListRangeChangeDetail } from '@absoluteui/components/virtual-list';
import { action, choice, createShowcase, section, status, toggle } from './kit.js';
const sc = createShowcase({
title: 'Workspace layout',
description: 'Resize or collapse the sidebar, scroll and select among 10,000 employees with the mouse or keyboard (arrows, Home, End, type-ahead), and filter to see the empty states.',
});
interface Employee {
id: string;
name: string;
title: string;
department: string;
location: string;
}
const FIRST = ['Ada', 'Grace', 'Alan', 'Katherine', 'Edsger', 'Barbara', 'Donald', 'Margaret', 'Tim', 'Radia', 'Linus', 'Frances'];
const LAST = ['Lovelace', 'Hopper', 'Turing', 'Johnson', 'Dijkstra', 'Liskov', 'Knuth', 'Hamilton', 'Berners-Lee', 'Perlman', 'Torvalds', 'Allen'];
const DEPARTMENTS = ['Engineering', 'Finance', 'Marketing', 'People', 'Sales'];
const TITLES = ['Analyst', 'Engineer', 'Manager', 'Specialist', 'Lead'];
const LOCATIONS = ['Berlin', 'Chennai', 'London', 'New York', 'Sydney'];
const pick = (list: readonly string[], i: number): string => list[i % list.length] ?? '';
const EMPLOYEES: Employee[] = Array.from({ length: 10_000 }, (_, i) => ({
id: `E${String(i + 1).padStart(5, '0')}`,
name: `${pick(LAST, Math.floor(i / FIRST.length))}, ${pick(FIRST, i)}`,
title: pick(TITLES, i * 7),
department: pick(DEPARTMENTS, i * 3),
location: pick(LOCATIONS, i * 11),
})).sort((a, b) => a.name.localeCompare(b.name) || a.id.localeCompare(b.id));
function row(e: Employee): Node {
const el = document.createElement('div');
el.className = 'sc-person';
const name = document.createElement('span');
name.className = 'sc-person__name';
name.textContent = e.name;
const meta = document.createElement('span');
meta.className = 'sc-person__meta';
meta.textContent = `${e.title}, ${e.department}`;
el.append(name, meta);
return el;
}
const area = section(sc, 'Employees', ['splitter', 'virtual-list', 'empty-state']);
const range = status(area);
const workspace = document.createElement('div');
workspace.className = 'sc-workspace';
area.append(workspace);
// The list's own empty content: shown when the filter matches nobody.
const noMatchHost = document.createElement('div');
const noMatch = EmptyState.create(noMatchHost, {
title: 'No employees in this department',
description: 'Choose another department or show everyone.',
icon: 'search',
size: 'sm',
headingLevel: null,
live: true,
primaryAction: { label: 'Show all departments' },
});
const listHost = document.createElement('div');
listHost.className = 'sc-workspace__list';
let visible = EMPLOYEES;
const list = VirtualList.create<Employee>(listHost, {
label: 'Employees',
items: visible,
height: null,
selection: 'single',
itemKey: (e) => e.id,
itemText: (e) => e.name,
itemHeight: 56,
empty: noMatchHost,
renderItem: row,
});
const detail = document.createElement('div');
detail.className = 'sc-workspace__detail';
const emptyHost = document.createElement('div');
const nothingSelected = EmptyState.create(emptyHost, {
title: 'No employee selected',
description: 'Select someone in the list to see their details.',
icon: 'search',
headingLevel: 3,
});
const card = document.createElement('section');
card.className = 'sc-workspace__card';
card.hidden = true;
detail.append(emptyHost, card);
const splitter = Splitter.create(workspace, {
panes: [
{ content: listHost, label: 'Employees', size: '38%', min: 200, max: '70%', collapsible: true },
{ content: detail, label: 'Details', min: 240 },
],
});
sc.listen(splitter.host, ['aui-change'], 'splitter');
const byId = new Map(EMPLOYEES.map((e) => [e.id, e]));
function showDetails(keys: readonly string[]): void {
const people = keys.map((k) => byId.get(k)).filter((e): e is Employee => e !== undefined);
emptyHost.hidden = people.length > 0;
card.hidden = people.length === 0;
if (people.length === 0) return;
const [first] = people;
if (people.length > 1 || !first) {
const h = document.createElement('h3');
h.textContent = `${String(people.length)} employees selected`;
const p = document.createElement('p');
p.textContent = people.slice(0, 5).map((e) => e.name).join('; ') + (people.length > 5 ? '; ...' : '');
card.replaceChildren(h, p);
return;
}
const h = document.createElement('h3');
h.textContent = first.name;
const dl = document.createElement('dl');
for (const [term, value] of [['Employee ID', first.id], ['Title', first.title], ['Department', first.department], ['Location', first.location]] as const) {
const dt = document.createElement('dt');
dt.textContent = term;
const dd = document.createElement('dd');
dd.textContent = value;
dl.append(dt, dd);
}
card.replaceChildren(h, dl);
}
list.host.addEventListener('aui-change', (e) => {
const d = (e as CustomEvent<VirtualListChangeDetail>).detail;
showDetails(d.value);
sc.log('list aui-change', d);
});
const showRange = (start: number, end: number): void => {
range.textContent = visible.length === 0 ? 'No employees shown.' : `Showing ${String(start + 1)} to ${String(end)} of ${visible.length.toLocaleString('en-US')} employees.`;
};
showRange(list.range.start, list.range.end);
list.host.addEventListener('aui-range-change', (e) => {
const d = (e as CustomEvent<VirtualListRangeChangeDetail>).detail;
showRange(d.start, d.end);
});
splitter.host.addEventListener('aui-change', (e) => {
// Change events of the components inside the panes bubble through the splitter too.
if (e.target !== splitter.host) return;
const d = (e as CustomEvent<SplitterChangeDetail>).detail;
range.dataset.sizes = d.sizes.join(',');
});
const filterBy = (value: string): void => {
visible = value === 'all' ? EMPLOYEES : EMPLOYEES.filter((e) => e.department === value);
list.update({ items: visible });
list.scrollToIndex(0, 'start');
showRange(list.range.start, list.range.end);
};
const departmentChoice = choice(
sc,
'Department',
[
{ value: 'all', label: 'All departments' },
...DEPARTMENTS.map((d) => ({ value: d, label: d })),
{ value: 'Legal', label: 'Legal (no one)' },
],
'all',
filterBy,
['virtual-list', 'empty-state'],
);
noMatchHost.addEventListener('aui-action', () => {
departmentChoice.setValue('all');
filterBy('all');
sc.log('empty-state aui-action', { action: 'primary' });
});
toggle(sc, 'Multiple selection', false, (multiple) => {
list.update({ selection: multiple ? 'multiple' : 'single', value: [] });
showDetails([]);
}, ['virtual-list']);
toggle(sc, 'Selection follows focus', false, (selectionFollowsFocus) => {
list.update({ selectionFollowsFocus });
}, ['virtual-list']);
choice(
sc,
'Layout',
[
{ value: 'horizontal', label: 'Side by side' },
{ value: 'vertical', label: 'Stacked' },
],
'horizontal',
(orientation) => {
splitter.update({ orientation });
},
['splitter'],
);
action(sc, 'Collapse or restore sidebar', () => {
if (splitter.collapsed[0]) splitter.expand(0);
else splitter.collapse(0);
}, ['splitter']);
action(sc, 'Jump to the middle', () => {
list.scrollToIndex(Math.floor(visible.length / 2), 'center');
}, ['virtual-list']);
action(sc, 'Clear selection', () => {
list.setValue([]);
showDetails([]);
}, ['virtual-list']);
toggle(sc, 'Compact empty states', false, (compact) => {
nothingSelected.update({ size: compact ? 'sm' : 'md' });
noMatch.update({ size: compact ? 'sm' : 'md' });
}, ['empty-state']);
import { EmptyState, type EmptyStateActionDetail } from '@absoluteui/components/empty-state';
const host = document.createElement('div');
document.body.append(host);
EmptyState.create(host, {
title: 'No employees match your filters',
description: 'Try a different name or clear the filters.',
icon: 'search',
live: true,
primaryAction: { label: 'Clear filters' },
});
host.addEventListener('aui-action', (event) => {
if ((event as CustomEvent<EmptyStateActionDetail>).detail.action === 'primary') host.dataset.cleared = 'true';
});
import { EmptyState } from '@absoluteui/components/empty-state';
const host = document.createElement('section');
document.body.append(host);
EmptyState.create(host, {
title: 'No projects yet',
description: 'Projects group people, budgets, and milestones.',
headingLevel: 2,
size: 'lg',
primaryAction: { label: 'Create project', icon: 'plus' },
secondaryAction: { label: 'Read the guide', href: '/docs/projects/' },
});
Terminal window
npm install @absoluteui/components @absoluteui/core @absoluteui/theme

Registry setup, the theme stylesheet, and the Content Security Policy are covered in Installation.

import { EmptyState } from '@absoluteui/components/empty-state';
import '@absoluteui/components/button/style.css';
import '@absoluteui/components/empty-state/style.css';
import { EmptyState } from '@absoluteui/components/empty-state';
import '@absoluteui/components/button/style.css';
import '@absoluteui/components/empty-state/style.css';
const host = document.querySelector<HTMLElement>('#projects-empty');
if (host) EmptyState.create(host, { title: 'No projects yet', description: 'Create one to get started.', primaryAction: { label: 'Create project', icon: 'plus' } });
More usage
import { EmptyState } from '@absoluteui/components/empty-state';
const host = document.querySelector<HTMLElement>('#inbox-empty');
if (host) {
const state = EmptyState.create(host, { title: 'No messages', description: 'New messages appear here.', icon: 'search', size: 'sm', headingLevel: null });
host.addEventListener('aui-action', () => {
state.update({ title: 'Checking for messages' });
});
}

Using Angular? See Empty State for Angular.

EmptyState.create(host: HTMLElement, options: EmptyStateOptions): EmptyState

Global configuration key: emptyState (see Configuration).

Option Type Default Description
title string Short statement of the state, such as ‘No employees match your filters’. Required.
description string What to do next or why the area is empty (text).
icon IconRef | null "null" Decorative icon above the title.
illustration Node | null "null" Decorative illustration (image or SVG Node) instead of the icon.
headingLevel 1 | 2 | 3 | 4 | 5 | 6 | null "3" Heading level of the title, or null for plain text (inside tables and lists).
primaryAction EmptyStateAction | null "null" Primary button { label, icon?, href? }.
secondaryAction EmptyStateAction | null "null" Secondary button { label, icon?, href? }.
live boolean "false" Announce the empty state when it appears (role=status).
size 'sm' | 'md' | 'lg' "md" sm inside tables and lists, md in panels, lg for whole pages. Globally configurable.
Property Type Description
host HTMLElement The host element.
options Readonly<EmptyStateOptions> Current options.
Method Description
update(options: Partial<EmptyStateOptions>): void Merge and apply options.
destroy(): void Remove rendering, buttons, and listeners.
Event Detail Bubbles Cancelable Description
aui-action EmptyStateActionDetail Yes No The user activated an action: { action: ‘primary’ | ‘secondary’ }.
Area Description
illustration A decorative image or SVG Node in place of the icon.

All rules live in the aui.components cascade layer, so application styles override them without specificity battles.

Class Purpose
aui-empty-state Host.
aui-empty-state--sm | --md | --lg Size.
aui-empty-state__media Icon or illustration (aria-hidden).
aui-empty-state__title Title (heading or paragraph).
aui-empty-state__description Description.
aui-empty-state__actions Action buttons.
aui-empty-state__primary | __secondary The primary and secondary action.
Slot Default icon
icon none

Tokens this stylesheet reads (verified in CI). Override them in a theme or with the Theme Designer.

--aui-color-text | --aui-color-text-muted | --aui-font-family-sans | --aui-font-size-lg | --aui-font-size-md | --aui-font-size-sm | --aui-font-size-xl | --aui-font-weight-semibold | --aui-icon-size-lg | --aui-icon-size-xl | --aui-line-height-normal | --aui-line-height-tight | --aui-space-1 | --aui-space-10 | --aui-space-2 | --aui-space-3 | --aui-space-4 | --aui-space-6

TypeScript definitions
type EmptyStateSize = 'sm' | 'md' | 'lg';
type EmptyStateHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
interface EmptyStateConfig { size: EmptyStateSize }
interface EmptyStateAction { label: string; icon?: IconRef; href?: string }
interface EmptyStateOptions extends Partial<EmptyStateConfig> {
title: string;
description?: string;
icon?: IconRef | null;
illustration?: Node | null;
headingLevel?: EmptyStateHeadingLevel | null;
primaryAction?: EmptyStateAction | null;
secondaryAction?: EmptyStateAction | null;
live?: boolean;
}
interface EmptyStateActionDetail { action: 'primary' | 'secondary' }

Pattern: Static content: a heading (or paragraph) with description and native buttons or links; optionally a polite status region so its appearance is announced.

Checked on every docs build: the showcase passes axe (WCAG 2.2 A and AA rules) in the default, dark, and high-contrast themes and right to left; the playground loads without errors and passes axe before and after every on/off option is switched, with no Content Security Policy violations.

Key Context Action
Tab Empty state The primary action, then the secondary action.
Enter / Space Action button Activate (Enter for links).
Element Role
host none, or status with live
title heading (h1 to h6) or paragraph
actions button or link (native)
Attribute Element Value
aria-hidden media true (the icon or illustration is decorative)
role host status when live is true

The empty state never takes or moves focus; when it replaces content that had focus, the application decides where focus goes.

Criterion Level Note
1.1.1 Non-text Content A
1.3.1 Info and Relationships A
1.4.3 Contrast (Minimum) AA
2.4.6 Headings and Labels AA
4.1.2 Name, Role, Value A
4.1.3 Status Messages AA

Automated test results: Accessibility and compliance.

  • Use headingLevel to fit the page outline; inside tables and lists use null so the title is plain text.
  • live announces the title and description when the empty state appears, for example after a search.
  • Manual screen-reader verification (NVDA, JAWS, VoiceOver) is pending.
Import cost Minified gzip brotli CSS brotli
@absoluteui/components/empty-state 38.4 kB 13.1 kB 11.6 kB 0.6 kB

Measured at build time, including every AbsoluteUI module the component pulls in. No third-party runtime dependencies.

Budget (enforced in CI) Limit
EmptyState.create with an icon and two actions < 1 ms average in headless Chromium

Tested scale: One per table, list, or page.

One small DOM subtree; update() rewrites text in place and rebuilds the buttons only when the action objects change.

Measured run times: Performance.

States

With an icon, an illustration, or no media; with or without actions; live; sizes sm, md, lg.

State transitions
From Trigger To
any update(options) new content; with live, the change is announced
idle an action is activated aui-action
Accessibility notes
  • Choose headingLevel to fit the page outline; inside tables and lists use null.
  • Use live where the empty state appears in response to a user action (a search or filter), so screen-reader users learn that nothing matched.
  • Put meaning in the title and description; the icon is never announced.
  • The e2e axe run covers three themes; manual screen-reader verification is pending.
Responsive behavior

Centered and fluid; the text wraps at a readable measure and the actions wrap on narrow containers.

Right-to-left

The layout is centered; the actions follow the writing direction.

Theming

The title and description colors are in the contrast gate in every theme; forced colors render the icon in CanvasText.

Global configuration
configureAbsoluteUI({ components: { emptyState: { size: 'sm' } } });
Component configuration

Instance size overrides configuration.

Icons

icon takes any registered icon (IconRef), for example search for no results or a set icon after @absoluteui/icons/set/register. Action icons go in primaryAction.icon and secondaryAction.icon.

Security

The title and description are set as text. Action href values are limited to http(s) and relative URLs (others throw). The illustration Node is inserted as given.

Data handling

No persistence, network access, or telemetry.

Supported data scale

One per table, list, or page.

Edge cases
  • An illustration wins over icon.
  • Without actions, the action row is hidden; without a description, the description is hidden.
  • Changing headingLevel replaces the title element (focus is not inside it).
Errors
Code Category Cause
EMPTY_STATE_OPTIONS configuration Blank title, a non-string description, an illustration that is not a Node, an invalid heading level, an action without a label, an unsafe action href, or a non-boolean live.
CFG_INVALID_VALUE / CFG_UNKNOWN_OPTION configuration Invalid or unknown configuration.
ICON_UNKNOWN configuration icon names an icon that is not registered.

Invalid options throw before the host is modified; an invalid update() leaves the previous state intact.

Known limitations
  • At most two actions.
  • The icon and illustration are decorative.
  • Manual screen-reader verification is pending.
Unsupported scenarios
  • Rich text (HTML) in the description: compose your own content next to the empty state.