Empty state
An empty state takes the place of a list, a table or a panel that has nothing to show. It says so in a title, explains in a line of text, and offers the action that fills the place. The words sit on the paper with no box, no picture and no colour; every line is one square.
Design examples
Section titled “Design examples”An icon, a title, a short explanation and one clear action.
<code data-source="html"><section class="specimen">
<ds-empty icon="folder" heading="The archive is empty" text="Keep a finished recording here when it is ready." literal><ds-button slot="actions" primary>Choose a recording</ds-button></ds-empty>
</section>
<style>
.specimen { width: 100%; min-width: 0; --cell: calc(20px * var(--ds-sf, 1)); }
.specimen .line { width: 100%; }
.specimen .grow { flex: 1; min-width: 0; }
.specimen .muted { color: var(--ds-text-color-muted); }
.specimen .mono { --ds-typeface-regular: var(--ds-typeface-mono); font-variant-numeric: tabular-nums; }
.specimen .value { width: calc(4 * var(--cell)); text-align: right; }
.specimen .mark { display: inline-flex; align-items: flex-end; width: var(--cell); height: var(--ds-control-height); flex: 0 0 var(--cell); }
.specimen .columns { display: flex; flex-wrap: wrap; gap: var(--cell); }
.specimen .columns > * { min-width: 0; }
.specimen fieldset { border: 0; padding: 0; margin: 0; }
.specimen legend { padding: 0; }
.specimen label { display: flex; align-items: flex-end; gap: calc(var(--cell) / 2); min-height: var(--cell); }
.specimen ds-panel { height: calc(10 * var(--cell)); }
</style></code> A centred empty state keeps its action close to the explanation.
<code data-source="html"><section class="specimen">
<ds-empty centered icon="search" heading="No photographs from November" text="Try another month or clear the filter." literal><ds-button slot="actions" secondary>Clear filter</ds-button></ds-empty>
</section>
<style>
.specimen { width: 100%; min-width: 0; --cell: calc(20px * var(--ds-sf, 1)); }
.specimen .line { width: 100%; }
.specimen .grow { flex: 1; min-width: 0; }
.specimen .muted { color: var(--ds-text-color-muted); }
.specimen .mono { --ds-typeface-regular: var(--ds-typeface-mono); font-variant-numeric: tabular-nums; }
.specimen .value { width: calc(4 * var(--cell)); text-align: right; }
.specimen .mark { display: inline-flex; align-items: flex-end; width: var(--cell); height: var(--ds-control-height); flex: 0 0 var(--cell); }
.specimen .columns { display: flex; flex-wrap: wrap; gap: var(--cell); }
.specimen .columns > * { min-width: 0; }
.specimen fieldset { border: 0; padding: 0; margin: 0; }
.specimen legend { padding: 0; }
.specimen label { display: flex; align-items: flex-end; gap: calc(var(--cell) / 2); min-height: var(--cell); }
.specimen ds-panel { height: calc(10 * var(--cell)); }
</style></code> An empty state can mark completion as well as absence.
<code data-source="html"><section class="specimen">
<ds-empty icon="check" heading="All proofs reviewed" text="There is nothing else waiting for your attention." literal centered></ds-empty>
</section>
<style>
.specimen { width: 100%; min-width: 0; --cell: calc(20px * var(--ds-sf, 1)); }
.specimen .line { width: 100%; }
.specimen .grow { flex: 1; min-width: 0; }
.specimen .muted { color: var(--ds-text-color-muted); }
.specimen .mono { --ds-typeface-regular: var(--ds-typeface-mono); font-variant-numeric: tabular-nums; }
.specimen .value { width: calc(4 * var(--cell)); text-align: right; }
.specimen .mark { display: inline-flex; align-items: flex-end; width: var(--cell); height: var(--ds-control-height); flex: 0 0 var(--cell); }
.specimen .columns { display: flex; flex-wrap: wrap; gap: var(--cell); }
.specimen .columns > * { min-width: 0; }
.specimen fieldset { border: 0; padding: 0; margin: 0; }
.specimen legend { padding: 0; }
.specimen label { display: flex; align-items: flex-end; gap: calc(var(--cell) / 2); min-height: var(--cell); }
.specimen ds-panel { height: calc(10 * var(--cell)); }
</style></code> Try it
Section titled “Try it”Without a heading, the title is the shared words in the current language.
<code data-source="html"><ds-empty icon="lists" text="Lists you make or are given appear here."> <ds-button slot="actions" primary>New list</ds-button> </ds-empty></code>
A heading and text of the page's own, centred in the space they stand in.
<code data-source="html"><ds-empty icon="search" heading="No results" text="Try another word, or clear the search." literal centered> <ds-button slot="actions" secondary>Clear the search</ds-button> </ds-empty></code>
Use it
Section titled “Use it”Without a heading, the title is the shared words’ “Nothing here yet” in the current language. Give a text that says what will appear here or what to do, and put the action in the actions slot: a button for an action, a link drawn as a button for a destination.
<code><span class="line"><span style="color:var(--docs-code-ink)"><</span><span style="color:var(--docs-code-tag)">ds-empty</span><span style="color:var(--docs-code-keyword)"> icon</span><span style="color:var(--docs-code-ink)">=</span><span style="color:var(--docs-code-string)">"lists"</span><span style="color:var(--docs-code-keyword)"> text</span><span style="color:var(--docs-code-ink)">=</span><span style="color:var(--docs-code-string)">"Lists you make or are given appear here."</span><span style="color:var(--docs-code-ink)">></span></span><span class="line"><span style="color:var(--docs-code-ink)"> <</span><span style="color:var(--docs-code-tag)">ds-button</span><span style="color:var(--docs-code-keyword)"> slot</span><span style="color:var(--docs-code-ink)">=</span><span style="color:var(--docs-code-string)">"actions"</span><span style="color:var(--docs-code-keyword)"> primary</span><span style="color:var(--docs-code-ink)">>New list</</span><span style="color:var(--docs-code-tag)">ds-button</span><span style="color:var(--docs-code-ink)">></span></span><span class="line"><span style="color:var(--docs-code-ink)"></</span><span style="color:var(--docs-code-tag)">ds-empty</span><span style="color:var(--docs-code-ink)">></span></span></code>
heading and text are translation keys, like Text; literal shows them as written. Words that need a link or a strong word go in the default slot, and a title that needs markup in the heading slot, as inline content.
A place can be empty because everything in it is finished: every receipt found, nothing left to review. tone="done" says so. Its icon is the check unless you give another, standing on a round mark one control high in the success green (--ds-success-color: Apple green deepened with the ink on light paper, Apple green itself on dark), and the title takes the same green.
<code><span class="line"><span style="color:var(--docs-code-ink)"><</span><span style="color:var(--docs-code-tag)">ds-empty</span><span style="color:var(--docs-code-keyword)"> tone</span><span style="color:var(--docs-code-ink)">=</span><span style="color:var(--docs-code-string)">"done"</span><span style="color:var(--docs-code-keyword)"> heading</span><span style="color:var(--docs-code-ink)">=</span><span style="color:var(--docs-code-string)">"Every receipt is found"</span><span style="color:var(--docs-code-keyword)"> text</span><span style="color:var(--docs-code-ink)">=</span><span style="color:var(--docs-code-string)">"New payments without one appear here."</span><span style="color:var(--docs-code-ink)">></span></span><span class="line"><span style="color:var(--docs-code-ink)"></</span><span style="color:var(--docs-code-tag)">ds-empty</span><span style="color:var(--docs-code-ink)">></span></span></code>
| Attribute | Type | Default | What it does |
|---|---|---|---|
heading | string | “Nothing here yet” | The title: a translation key, or the words with literal. |
text | string | Empty | The line under the title. The default slot takes its place. |
literal | boolean | false | Show heading and text as written, never looked up. |
icon | string | Empty | An icon inline before the title, in the muted ink. |
centered | boolean | true | Centre the words in the space the element stands in. |
level | number | None | Make the title a heading of this level, 1 to 6. |
tone | done | None | Empty because everything is finished: the check (or icon) on the success green’s mark, the title in that green. |
| Slot | What it holds |
|---|---|
| Default | The text, when it needs more than words. |
heading | The title. |
icon | An icon of the page’s own. |
actions | Buttons or links, on one row one square below the text. |
Measures
Section titled “Measures”The block is at most sixteen squares wide (--ds-empty-measure), with no room above or below unless the page gives it some (--ds-empty-padding). The block, text and actions are centred. The icon and title share the first square: a 16px icon with 4px before the title, both on the lower sixteen (scaled). Each line of text takes one square; one square stands between the text and the actions, which share a row with half a square between them. The title is in the medium face and the text in the muted ink. Nothing is illustrated and nothing is in capitals.
React uses the element directly. The heading, text and actions are light DOM, so the words are in the server’s HTML and in the product’s tests. Register ds-empty in the browser before hydration.
<code><span class="line"><span style="color:var(--docs-code-keyword)">import</span><span style="color:var(--docs-code-string)"> "@0001-labs/design-system-1/ds1/2-core/ds-empty"</span><span style="color:var(--docs-code-ink)">;</span></span><span class="line"></span><span class="line"><span style="color:var(--docs-code-ink)"><</span><span style="color:var(--docs-code-tag)">ds-empty</span><span style="color:var(--docs-code-keyword)"> icon=</span><span style="color:var(--docs-code-string)">"search"</span><span style="color:var(--docs-code-keyword)"> heading=</span><span style="color:var(--docs-code-string)">"No results"</span><span style="color:var(--docs-code-keyword)"> text=</span><span style="color:var(--docs-code-string)">"Try another word."</span><span style="color:var(--docs-code-ink)">></span></span><span class="line"><span style="color:var(--docs-code-ink)"> <</span><span style="color:var(--docs-code-tag)">ds-button</span><span style="color:var(--docs-code-keyword)"> slot=</span><span style="color:var(--docs-code-string)">"actions"</span><span style="color:var(--docs-code-keyword)"> secondary</span><span style="color:var(--docs-code-keyword)"> onClick=</span><span style="color:var(--docs-code-ink)">{clear}>Clear the search</</span><span style="color:var(--docs-code-tag)">ds-button</span><span style="color:var(--docs-code-ink)">></span></span><span class="line"><span style="color:var(--docs-code-ink)"></</span><span style="color:var(--docs-code-tag)">ds-empty</span><span style="color:var(--docs-code-ink)">></span></span></code>