Skip to content

Empty

Which kind of empty an area is, and what a long wait says.

<div class="cap-empty" data-kind="nothing-yet" id="sample-nothing">
  <div class="cap-empty-media" data-variant="icon" aria-hidden="true"><svg viewBox="0 0 16 16" aria-hidden="true" focusable="false"><circle cx="8" cy="8" r="6.2" fill="none" stroke="currentColor" stroke-width="1.4"/><path fill="none" stroke="currentColor" stroke-width="1.4" d="M1.8 8h12.4M8 1.8c2 1.8 3 3.9 3 6.2s-1 4.4-3 6.2c-2-1.8-3-3.9-3-6.2s1-4.4 3-6.2z"/></svg></div>
  <div class="cap-empty-header">
    <p class="cap-empty-title">No sites are watched yet</p>
    <p class="cap-empty-text">Add the first one and its checks start on the next pass.</p>
  </div>
  <div class="cap-empty-content">
    <button type="button" class="cap-btn" data-variant="primary">Add a site</button>
  </div>
</div>

Installation

// package.json: "capsomer": "github:DrDustinEdwards/capsomer#v0.152.2"
import "capsomer/tokens.css";
import "capsomer/base.css";
import "capsomer/empty.css";

Usage

<div class="cap-empty" data-kind="nothing-yet">
  <div class="cap-empty-media" data-variant="icon" aria-hidden="true"><svg>...</svg></div>
  <div class="cap-empty-header">
    <p class="cap-empty-title">No sites are watched yet</p>
    <p class="cap-empty-text">Add the first one and its checks start on the next pass.</p>
  </div>
  <div class="cap-empty-content"><button type="button" class="cap-btn" data-variant="primary">Add a site</button></div>
</div>

<div class="cap-empty" data-kind="no-match" data-flush>
  <div class="cap-empty-header">
    <p class="cap-empty-title">No jobs match “Blocked”</p>
    <p class="cap-empty-text">14 jobs are hidden by this filter.</p>
  </div>
  <div class="cap-empty-content"><button type="button" class="cap-btn">Clear filter</button></div>
</div>

<div class="cap-empty" data-kind="all-clear">
  <div class="cap-empty-header">
    <p class="cap-empty-title"><span class="cap-status" data-tone="ok">[ok glyph]All clear</span></p>
    <p class="cap-empty-text">No mentions are waiting.</p>
  </div>
</div>

<div class="cap-empty" data-kind="failed" role="alert">
  <div class="cap-empty-header">
    <p class="cap-empty-title">[critical glyph]Could not load the queue</p>
    <p class="cap-empty-text">The server answered with an error (502). Nothing changed on your side.</p>
  </div>
  <div class="cap-empty-content"><button type="button" class="cap-btn">Try again</button></div>
</div>

<div class="cap-empty-wait" aria-busy="true">
  [spinner, labeled "Building the site"]
  <p class="cap-empty-text">This usually takes about 30 seconds.</p>
</div>

Examples

No match

<div class="cap-empty" data-kind="no-match" id="sample-nomatch">
  <div class="cap-empty-header">
    <p class="cap-empty-title">No jobs match “Blocked”</p>
    <p class="cap-empty-text">14 jobs are hidden by this filter.</p>
  </div>
  <div class="cap-empty-content">
    <button type="button" class="cap-btn">Clear filter</button>
  </div>
</div>

All clear

<div class="cap-empty" data-kind="all-clear" id="sample-clear">
  <div class="cap-empty-header">
    <p class="cap-empty-title"><span class="cap-status" data-tone="ok"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" fill-rule="evenodd" d="M8 1a7 7 0 1 0 0 14A7 7 0 1 0 8 1zM3.9 9l3 3 5.2-5.6-1.4-1.4-3.8 4.2-1.6-1.6z"/></svg>All clear</span></p>
    <p class="cap-empty-text">No mentions are waiting. Approved, spam and Trash are one tab away.</p>
  </div>
</div>

Could not load

<div class="cap-empty" data-kind="failed" role="alert" id="sample-failed">
  <div class="cap-empty-header">
    <p class="cap-empty-title"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" fill-rule="evenodd" d="M5 1h6l4 4v6l-4 4H5l-4-4V5zM7.2 4h1.6v5H7.2zM7.2 10.4h1.6V12H7.2z"/></svg>Could not load the queue</p>
    <p class="cap-empty-text">The server answered with an error (502). Nothing changed on your side.</p>
  </div>
  <div class="cap-empty-content">
    <button type="button" class="cap-btn">Try again</button>
  </div>
</div>

Flush, inside a panel that has its own edge

<div class="cap-empty" data-kind="no-match" data-flush id="sample-flush">
  <div class="cap-empty-header">
    <p class="cap-empty-title">No mentions in Trash</p>
    <p class="cap-empty-text">Mentions in Trash stay here for 30 days. <a href="#s-flush">Read about Trash</a>.</p>
  </div>
</div>

0.1 markup: the title, the text and the action as direct children

<div class="cap-empty" data-kind="nothing-yet" id="sample-direct">
  <p class="cap-empty-title">No drafts yet</p>
  <p class="cap-empty-text">Start one from a mention.</p>
  <button type="button" class="cap-btn">New draft</button>
</div>

Comfortable density

<div class="cap-empty" data-kind="nothing-yet" data-density="comfortable" id="sample-comfortable">
  <div class="cap-empty-media" data-variant="icon" aria-hidden="true"><svg viewBox="0 0 16 16" aria-hidden="true" focusable="false"><circle cx="8" cy="8" r="6.2" fill="none" stroke="currentColor" stroke-width="1.4"/><path fill="none" stroke="currentColor" stroke-width="1.4" d="M1.8 8h12.4M8 1.8c2 1.8 3 3.9 3 6.2s-1 4.4-3 6.2c-2-1.8-3-3.9-3-6.2s1-4.4 3-6.2z"/></svg></div>
  <div class="cap-empty-header">
    <p class="cap-empty-title">No sites are watched yet</p>
    <p class="cap-empty-text">Add the first one and its checks start on the next pass.</p>
  </div>
  <div class="cap-empty-content">
    <button type="button" class="cap-btn" data-variant="primary">Add a site</button>
  </div>
</div>

A long wait, over 10 seconds

<div class="cap-empty-wait" aria-busy="true" id="sample-wait">
  <span class="cap-spinner"><svg class="cap-spinner-arc" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><circle cx="8" cy="8" r="6" fill="none" stroke="currentColor" stroke-width="2" opacity="0.25"/><path fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" d="M8 2a6 6 0 0 1 6 6"/></svg><span class="cap-spinner-label">Building the site</span></span>
  <p class="cap-empty-text">This usually takes about 30 seconds.</p>
</div>

No value

<div class="cap-specimen-row" id="e-missing">
  <p>Last deploy: <span class="cap-missing">none</span></p>
  <p>Owner: <span class="cap-missing" title="No one has claimed it">none<span class="cap-sr-only">: No one has claimed it</span></span></p>
</div>

API reference

Empty

PropTypeRequiredDoes
kindEmptyKindYes
titleReactNodenothing-yet: "No sites are watched yet". no-match: "No jobs match “Blocked”". failed: "Could not load the queue". all-clear: defaults to "All clear".
childrenReactNodeOne plain sentence: how to add the first, what the filter hides, what failed.
actionReactNodenothing-yet: the one way to add the first. no-match: Clear filter. failed: Try again.
iconReactNodeAn icon in a muted tile above the title (an svg). Decorative: the title says it.
flushbooleanNo edge, for inside a panel or a table that already has one.
titleAs"p" | "h1" | "h2" | "h3"The title's element: a paragraph by default, a heading where the empty area is the page's subject (the error page's h1).
role"status"A polite status, for an empty area that replaces the page's content when nothing failed (the signed-out page). A failed one is always an alert.

Wait

PropTypeRequiredDoes
labelstringYes
childrenReactNodeYesOver 10 seconds, say how long: "This usually takes about 30 seconds."

Missing

PropTypeRequiredDoes
childrenReactNodeThe word for no value. Default "none".
reasonstringWhy there is none, read out with the word (and shown on hover when it is text).

Parts and data attributes

ClassIs
.cap-emptythe root
.cap-empty-contenta part
.cap-empty-headera part
.cap-empty-mediaa part
.cap-empty-texta part
.cap-empty-titlea part
.cap-empty-waita part
.cap-missingits own class
AttributeValues
data-flushpresent or absent
data-kindfailed
data-varianticon

Accessibility

KeyDoes
TabReaches the kind's action (Add, Clear filter, Try again); all clear has none
  • The title is --text, the line under it --muted, the failed title --crit: 4.5:1 in both themes.
  • failed is role="alert"; add it when the read fails so it is announced.
  • The icon tile is decorative (aria-hidden); the title carries the meaning.
  • Forced colors: the dashed edge and the icon tile take the system text color.