Skip to Content
Getting startedFoundationsComponentsPackagesTools

EmptyState

What stands in for content that is not there, and why it is not.

Examples

Playground

Add your first colour

Add by hex or extract from an image.

The three situations

first use

Add your first colour

Add by hex or extract from an image.

no results

No colours match this filter

Try a wider search, or clear the filter.

error, announced

Couldn’t open your library

The file is there but could not be read.

Title only

No results

With icon

The `icon` slot sits above the title as the visual anchor for the block. A slot is invisible until something is put in it, so it gets a story of its own. haus ships no icon set, so the glyph is the consumer’s: this is a plain inline SVG using `currentColor`, which the `.icon` rule colours.

Add your first colour

Add by hex or extract from an image.

Install

npx shadcn add @hipuku/empty-state

Usage

import { EmptyState } from '@/components/haus/components/EmptyState'

<EmptyState
  title="No colours yet"
  description="Add one by hex, or extract a palette from an image."
  action={<Button variant="primary">Add a colour</Button>}
/>

API

EmptyState also takes its element's own attributes and forwards its ref. className lands on the root.

PropTypeDescription
titlerequiredstringWhy the region is empty, in a few words. Required, and it is the whole component. An empty region with no explanation is indistinguishable from one that has not loaded, and the writing is the part a design system can actually standardise: what a never-had-anything state says, and how a filtered-to-nothing state says something different.
descriptionstring
actionReact.ReactNodeThe thing that fills the void. Omit it where nothing the reader can do would: a filtered-to-nothing state wants "clear the filter", and a permissions one wants no button at all.
iconReact.ReactNodeAn illustration or glyph. Decorative: the title carries the meaning.
headingLevelEmptyStateHeadingLevel
live"off" | "polite"

Writing it

An empty state is mostly a sentence, and there are three different ones:

SituationSayAction
Nothing yetThere is nothing here, and how to startThe control that starts it
Filtered to nothingThe filter is too narrowClear the filter
Could not loadIt failed, which is not the same as emptyRetry, or none

Leave out action when nothing the reader can do would fill the space.

Set live="polite" when the empty state appears in response to something, such as a search with no results or a failed load. Otherwise it is not announced, and a failure reads as an empty list.

Accessibility

  • title is a real heading. Set headingLevel to fit the page: it defaults to 3.
  • The icon is decorative. The title carries the meaning.
  • The action keeps its own place in the tab order.

On this page