EmptyState

What a page or list shows when there is nothing in it yet.

Overview

A whole page or list with no content yet: say what belongs here and offer the first step.

Next step

Do

No builds yet

Builds appear here once a project has uploaded its first capture.

import { Body, Button, EmptyState } from "@hackcove/ui";

<EmptyState title="No builds yet" actions={<Button>Create a project</Button>}>
  <Body as="p">Builds appear here once a project has uploaded its first capture.</Body>
</EmptyState>
An empty page says what belongs here and offers the first step as the primary action.
Don't

Nothing here

import { EmptyState } from "@hackcove/ui";

<EmptyState title="Nothing here" />
A bare "Nothing here" is a dead end: it does not say what belongs here or what to do next.

Inline

Do

Builds

No builds yet.

import { Card, Empty } from "@hackcove/ui";

<Card title="Builds">
  <Empty>No builds yet.</Empty>
</Card>
An empty list inside a card is one muted line: Empty.
Don't

Builds

No builds yet

Builds appear here once a project has uploaded its first capture.

import { Body, Card, EmptyState } from "@hackcove/ui";

<Card title="Builds">
  <EmptyState title="No builds yet">
    <Body as="p">Builds appear here once a project has uploaded its first capture.</Body>
  </EmptyState>
</Card>
EmptyState is for a whole page or list; inside a small card it is a block that dwarfs the card.

Usage

  • Give it a title, one Body as="p" that says what belongs here, and the first step as actions, with the primary Button first.
  • For a get-started list, put Steps after the Body in the children.
  • One muted line inside a card, for an empty table or list, is Empty, not an EmptyState.
  • Do not leave it as a title alone: a page with nothing in it and nothing to do is a dead end.

Accessibility

  • An EmptyState is a <section> named by its title, which is an h2, so it is a landmark region a screen reader can jump to.
  • The actions are ordinary buttons and links, in reading order after the explanation.

API

EmptyState

What a list or a page shows when there is nothing in it yet: a centred title, the children as the explanation under it (a Body as="p", then Steps for a "get started" list), and actions (buttons, links) in a centred row at the bottom. A named <section>. For one muted line inside a card, use Empty.


actions
Type
ReactNode

title required
Type
ReactNode