Content blocks
Empty state
What an empty list shows: one line on what is missing, one slate line, and the one action that fills it.
- Block
.hs-empty- CSS
components/empty-state.css(in/brand.css)- JS
- None
- Status
- Decided
- Decided in
- Components round 2b
- Markdown
- /components/empty-state.md
What it is
What a list shows when it has nothing in it yet: one Didot line that says what is missing, one slate line, one action that fills it.
When to use
- A member’s own list with nothing in it yet, such as their articles. It replaces
.hs-blog-empty. - Another member’s empty list: the line only, with no icon and no action.
- A search or a filter that matched nothing:
--search.
When not to use
- A message after an action, or an error: use the Callout.
- A list that has items and more to show: use Load more or the Pager.
Rules
- Markup:
div.hs-emptywith an optionalsvg.hs-empty__icon,h3.hs-empty__title,p.hs-empty__textand an optional.hs-empty__actions. - The title says what is missing, in one line. Write no apology and add no illustration.
- Give one action: the one that fills the list. It carries
data-ph-capture-attribute-ctaanddata-ph-capture-attribute-cta-loc. - When the viewer cannot fill the list, drop the icon and the action. The title names the member: “Avery Example hasn’t published any articles yet.”
--searchis help, not a dead end. The title says what matched nothing, with the escaped query: “No results for “nursng”.” The text gives the fix: a spelling tip and, when filters are set, a “Clear all filters” link in the text. Thenp.hs-empty__links-titleandul.hs-empty__linkswith two to four popular destinations, eachli > a.hs-empty__link: a centred, wrapping row of navy-outline pill links, 44px tall. The shared focus ring applies. No button. On the search page the title ish2: it sits right under the H1.
Accessibility
- The title is a heading, so a screen reader finds the empty list in the outline.
- The icon takes
aria-hidden="true" focusable="false". - Contrast on soft: title navy 11.7:1; text slate 5.9:1.
- The action is a real link, so it works without JavaScript.
Variants
Empty state
When the viewer cannot fill the list, drop the icon and the action.
Preview on white
You have not published an article yet.
Your articles appear on your profile, under the Articles tab.
<div class="hs-empty">
<svg class="hs-empty__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M4 20h4L19 9a2.8 2.8 0 0 0-4-4L4 16v4z"/><path d="M13.5 6.5l4 4"/></svg>
<h3 class="hs-empty__title">You have not published an article yet.</h3>
<p class="hs-empty__text">Your articles appear on your profile, under the Articles tab.</p>
<div class="hs-empty__actions">
<a class="hs-button" href="/blog/new" data-ph-capture-attribute-cta="start_article" data-ph-capture-attribute-cta-loc="member-articles">Write an article</a>
</div>
</div>No results (search)
A search that matched nothing: the fix, then popular destinations.
Preview on white
No results for “nursng”.
Check the spelling or try a shorter word. You can also clear all filters.
Popular pages
<div class="hs-empty hs-empty--search">
<h2 class="hs-empty__title">No results for “nursng”.</h2>
<p class="hs-empty__text">Check the spelling or try a shorter word. You can also <a href="/search/node">clear all filters</a>.</p>
<p class="hs-empty__links-title">Popular pages</p>
<ul class="hs-empty__links">
<li><a class="hs-empty__link" href="/scholarship-directory" data-ph-capture-attribute-cta="scholarship-directory" data-ph-capture-attribute-cta-loc="no-results">Scholarship directory</a></li>
<li><a class="hs-empty__link" href="/benefits" data-ph-capture-attribute-cta="benefits" data-ph-capture-attribute-cta-loc="no-results">Member benefits</a></li>
<li><a class="hs-empty__link" href="/faqs" data-ph-capture-attribute-cta="faqs" data-ph-capture-attribute-cta-loc="no-results">Frequently asked questions</a></li>
</ul>
</div>