Empty state

What people see when there is nothing to show yet.

import { EmptyState } from '@halo-ds/react';

When to use it

Use an empty state in place of a list, table or page that has no content: before anything is created, when a search finds nothing, when everything is done, or when content could not load. Say what is missing and, when there is one, the next step. A button is optional; often a short message is all it needs.

Do

  • Say what is missing in the title, in a few words.
  • Add a button only when there is a clear next step.
  • Use Small inside cards, lists and panels.
  • Put the empty state where the content would be.

Don't

  • Show an empty state while content is still loading.
  • Add more than two buttons.
  • Blame people or joke about the problem.
  • Use a picture that needs words to explain it.

Empty state, Skeleton or Alert?

Pick by what is happening: nothing to show, still loading, or something went wrong.

  • Empty state: There is nothing to show here, and that is expected. It sits where the content would be. It stays until content arrives.
  • Skeleton or Alert: Skeleton: content is still loading, so show its shape. Alert: something went wrong that affects the whole page. Never show an empty state while content is still loading.

Props

EmptyState props

PropTypeWhat it does
size`"sm" \"lg" \undefined`Figma: Size.
iconReactNodeAn icon shown in a grey circle. Figma: Media slot.
mediaReactNodeAn illustration or image instead of the icon circle. Figma: Media slot.
title (required)ReactNodeFigma: Title.
descriptionReactNodeSay why it is empty and what to do next. Figma: Description.
actionsReactNodeUsually a primary Button and a secondary one. Figma: Actions.
classNames`Partial<Record<EmptyStatePart, string>> \undefined`Extra class names for the parts inside the component, by part name, like { header: 'my-header' }.
styles`Partial<Record<EmptyStatePart, CSSProperties>> \undefined`Inline styles for the parts inside the component, by part name, like { footer: { gap: 4 } }.

It also takes the usual HTML attributes for its element.

Examples

Overview

import { Button, EmptyState, Illustration } from '@halo-ds/react';

export default function Example() {
  return (
    <EmptyState
      media={<Illustration name="no-projects" />}
      title="No projects yet"
      description="Create a project to start organising your work."
      actions={<Button>New project</Button>}
    />
  );
}

Small

For a card or a side panel.

import { Button, EmptyState } from '@halo-ds/react';
import { MagnifyingGlass } from '@phosphor-icons/react';

export default function Demo() {
  return (
    <div className="demo-panel" style={{ width: 340 }}>
      <EmptyState size="sm" icon={<MagnifyingGlass />} title="No results" description="Try a different search or clear the filters." actions={<Button size="sm" variant="secondary">Clear filters</Button>} />
    </div>
  );
}

Illustration

Illustrations suit large empty states, like an inbox with nothing new.

import { EmptyState, Illustration } from '@halo-ds/react';

export default function Demo() {
  return <EmptyState media={<Illustration name="all-caught-up" />} title="You're all caught up" description="New messages will show up here." />;
}

More: https://halodesignsystem.dev/components/empty-state