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>Don't
Nothing here
import { EmptyState } from "@hackcove/ui";
<EmptyState title="Nothing here" />
Inline
Do
Builds
No builds yet.
import { Card, Empty } from "@hackcove/ui";
<Card title="Builds">
<Empty>No builds yet.</Empty>
</Card>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, oneBody as="p"that says what belongs here, and the first step asactions, with the primaryButtonfirst. - For a get-started list, put
Stepsafter theBodyin 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 itstitle, which is anh2, 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