Skip to content
Español

Navigate

Type to search. Press Escape to close.

    Components · css New in 1.1

    Empty state

    What a list, a table or a search shows when there is nothing to show yet, and what to do about it. A centred block with an icon on a soft brand halo, a title, one sentence and the next action, so the moment reads as designed rather than broken. It is CSS on ordinary markup: the heading is a real heading and the actions are real buttons and links.

    CSS: css/components/empty.css (in ivolt.css). JS: none. New in 1.1.

    First use and no resultsfixtures/empty/basic.htmlOpen alone — First use and no results
    <div class="iv-grid iv-u-gap-5 iv-u-grid-cols-1 iv-u-lg-grid-cols-2">
      <section class="iv-card">
        <div class="iv-empty">
          <div class="iv-empty__icon" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"/><path d="M14 3v5h5M9 13h6M9 17h4"/></svg></div>
          <h3 class="iv-empty__title">No invoices yet</h3>
          <p class="iv-empty__text">Invoices appear here once the first billing period closes. You can also create one by hand.</p>
          <div class="iv-empty__actions">
            <button class="iv-button iv-button--primary" type="button">Create an invoice</button>
            <a class="iv-button iv-button--ghost" href="#empty-note">How billing works</a>
          </div>
        </div>
      </section>
    
      <div class="iv-empty iv-empty--bordered iv-empty--compact">
        <div class="iv-empty__icon" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><circle cx="11" cy="11" r="6.5"/><path d="m20 20-4.2-4.2"/></svg></div>
        <h3 class="iv-empty__title">No results for “quarterly”</h3>
        <p class="iv-empty__text">Check the spelling or search all projects instead of this one.</p>
      </div>
    
      <p class="iv-u-m-0 iv-u-text-sm iv-u-text-muted" id="empty-note">Demo states: there is no billing behind this page and the button creates nothing.</p>
    </div>

    When to use it

    There are three kinds of empty, and each deserves different words:

    • First use — nothing has been created yet. Explain what will appear here and offer the action that creates the first item (“Create an invoice”).
    • No results — a search or a filter matched nothing. Repeat what was searched, suggest how to widen it, and offer to clear the filters. The compact, bordered variant fits inside a results panel.
    • Cleared — the reader finished everything (an empty inbox). A short, positive line is enough; an action is optional.

    An empty state is not an error. When loading failed, say so with an alert and a way to retry; when it is still loading, show a skeleton or a spinner.

    Anatomy and variants

    <div class="iv-empty">
      <div class="iv-empty__icon" aria-hidden="true"><svg …></svg></div>
      <h3 class="iv-empty__title">No invoices yet</h3>
      <p class="iv-empty__text">Invoices appear here once the first billing period closes.</p>
      <div class="iv-empty__actions">…</div>
    </div>

    iv-empty--bordered draws a dashed frame, for an empty slot inside a page (a drop zone, a column with no cards). iv-empty--compact reduces the padding and the icon for panels and sidebars. Both combine. Inside an iv-card the plain variant needs no frame of its own.

    Accessibility

    • Use the heading level that fits the page outline — h2 in a main column, h3 inside a card. The class styles any level.
    • The icon is decoration: aria-hidden="true". The title must make sense without it.
    • When the empty state replaces results after a search, announce the change: put the result count (“0 results for ‘quarterly’”) in a role="status" element near the search field.
    • Primary action first in the source order, so the keyboard reaches it first.

    Customising

    .trash .iv-empty { --iv-empty-tone: var(--iv-color-danger); }

    Local: --iv-empty-tone, the colour of the icon and its halo (the primary by default, so it follows a one-colour theme). The title uses the display tracking of the system and the text is the muted colour at the reading measure.

    Common mistakes

    • “No data” and nothing else. Say what is missing and what to do.
    • An illustration so large that the action falls below the fold on a phone.
    • Using an empty state while the data is still loading: the reader thinks there is nothing and leaves.
    • A button that creates nothing. The fixture above says so in its note; your product's buttons should work.

    Class index

    Every class of the family. The full list per stylesheet lives in the reference.

    ClassWhat it does
    iv-emptyThe centred block.
    iv-empty__iconIcon on a brand halo (decorative).
    iv-empty__titleThe heading, at any level.
    iv-empty__textOne sentence of explanation.
    iv-empty__actionsRow of actions.
    iv-empty--borderedDashed frame for an empty slot.
    iv-empty--compactLess padding, smaller icon.