Skip to content

Empty state

BetaData displayOpen in the workshop

What a view shows when there is nothing in it yet, nothing matches, or it failed.

.xg-empty > .xg-empty__icon | img.xg-empty__art + .xg-empty__title + p + .xg-row of actions

Example and markup

Live, from xg-ui.css and xg-ui.js. Switch the brand and mode on the example itself, or for the whole site in the header.

Empty state

No campaigns yet

Create your first campaign to start buying traffic. It takes about five minutes.

Markup
<div class="xg-card">
<div class="xg-empty">
<img class="xg-empty__art" src="/brand/xendiz/illustrations/feature-analytics-transparent.png" alt="" width="160">
<h3 class="xg-empty__title">No campaigns yet</h3>
<p>Create your first campaign to start buying traffic. It takes about five minutes.</p>
<div class="xg-row">
<button class="xg-btn" type="button">
<svg class="xg-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
<path d="M12 5v14"/>
<path d="M5 12h14"/>
</svg>Create campaign</button>
<button class="xg-btn xg-btn--ghost" type="button">Read the guide</button>
</div>
</div>
</div>

Variants

No results and error

No campaigns match

Nothing matches “podcast” with the filters Country: US and Status: Live.

The report did not load

The reporting service did not answer in time. Your data is safe.

Markup
<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:16px">
<div class="xg-card">
<div class="xg-empty">
<span class="xg-empty__icon">
<svg class="xg-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
<circle cx="11" cy="11" r="7"/>
<path d="m20 20-3.5-3.5"/>
</svg>
</span>
<h3 class="xg-empty__title">No campaigns match</h3>
<p>Nothing matches “podcast” with the filters Country: US and Status: Live.</p>
<div class="xg-row">
<button class="xg-btn xg-btn--secondary" type="button">Clear filters</button>
</div>
</div>
</div>
<div class="xg-card">
<div class="xg-empty">
<span class="xg-empty__icon" style="background:var(--xg-color-status-error-tint);color:var(--xg-color-status-error-text)">
<svg class="xg-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
<path d="M12 3 2 20h20L12 3Z"/>
<path d="M12 10v4"/>
<path d="M12 17h.01"/>
</svg>
</span>
<h3 class="xg-empty__title">The report did not load</h3>
<p>The reporting service did not answer in time. Your data is safe.</p>
<div class="xg-row">
<button class="xg-btn" type="button">Try again</button>
</div>
</div>
</div>
</div>

When to use it

Use it for

first use, no search results, no data for the period, permission or load errors.

Not for

decorating a view that has content.

Rules

  • Say what is missing and the next step: a title, one sentence, one primary action.
  • No results: offer “Clear filters”. First use: offer the create action. Error: offer “Try again” and what to tell support.
  • Illustrations only from the brand set and only for first use; filter and error states use a UI glyph.

Accessibility

  • The title is a heading at the right level for the page.

Every color pair this component uses is measured for both brands in light and dark on the Accessibility page.

Also in Data display: Data table, Pagination, KPI card, Status badge, Tag, Avatar, Progress, Chart, Tooltip, Skeleton, Spinner. Used in the patterns Loading, empty and error states.

Status Beta: usable; class names may still change in a minor release, with a note (see Releasing).