Raft Design System

Components · Feedback

EmptyState

What a view shows when it has no content — a gray icon, a title, a helper sentence only when there is a way out or a consequence to say, and at most one button.

StableAlso called Empty, Blank slate
import { EmptyState } from "@botiverse/raft-ui";

An empty state tells people a view has no content. It has one look everywhere: a gray icon with no frame, a gray title, a helper sentence only when there is a way out or a consequence the title doesn't say, and at most one button. It is a conclusion ("there is nothing here"), so it never stands in for loading or a failure.

empty-state/compositions/default

When to use

SituationUse
There is nothing here yetEmptyState: why it is empty and how to make something appear
Filters or a search match nothingEmptyState: which conditions are active, with Clear all
It is still loadingSkeleton, not an empty state
It failed to loadAn error at its scope, with Retry (Feedback)

Anatomy

  • EmptyState: the centered root. Required.
  • EmptyStateContent: groups the icon, title and description. Required.
  • EmptyStateIcon: a Lucide icon, at 36px in foreground-hint. Required.
  • EmptyStateTitle: the title, in foreground-muted. Required.
  • EmptyStateDescription: one helper sentence, in foreground-hint. It takes only a HelperText, made with helperText(content, { why, about }), and renders its why and about as data-why and data-about, and is only for a consequence (consequence), who sees it or whom it affects (audience), or how to recover (recovery) (Writing › Helper text). A link in it is 600 with no underline at rest and underlines in ink on hover (Clickable text): the weight is what sets it apart from the grey sentence.
  • EmptyStateActions: at most one button.
empty-state/compositions/activity-inbox

Content

  • Write the title in sentence case and state the fact: "No tasks yet", "No tasks match these filters" (Writing).
  • Give the view a description only when there is a way out of it ("Try another query or remove one of the active filters", recovery) or a consequence the title doesn't say. A view with nothing yet takes the title alone: how something gets here ("Conversations you start will show up here") is cut.
  • For filters or a search with no results, name the conditions that are active, and label the button Clear all.

Accessibility

  • EmptyStateIcon is hidden from assistive technology (aria-hidden): the title says what is empty.
  • When the empty state is the only content of a page or panel, render the title as a heading (render) at the level the page needs.

Rules

  • Put the empty state directly in the middle of the content area. Don't wrap it in a card, frame the icon or add a sticker: empty states are working pages (Brand).
  • Give it at most one button: a 32px ink-bordered button (variant="default" size="md"), never pink.
  • Keep it quiet. The empty state is a hint, not a heading: small, faint type that doesn't compete with the button people should press next.

API

EmptyState, EmptyStateActions, EmptyStateContent

PropTypeDefault
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)

Also takes the attributes of its element.

EmptyStateDescription

PropTypeDefault
children (required)HelperText
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)

Also takes the attributes of its element.

EmptyStateIcon, EmptyStateTitle

PropTypeDefault
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)

Also takes the attributes of its element.

Changes

  • 0.103.0 · Breaking ChangesExplanation slots take only a HelperText: FieldDescription, FormSection's description, a ChoiceList item's description, SelectItemDescription, DialogDescription, AlertDialogDescription, DrawerDescription, PopoverDescription, EmptyStateDescription, CardDescription, CardFooter, BannerDescription, DialogFooterNote (work in progress), MessageActionCardHint, MessageActionCardHeaderDescription, MessageActionCardScopeDescription and MessageActionCardActionsNote. A HelperText is made only by helperText(content, { why, about }): content is any ReactNode (a string, a formatted message, a TextLink inside a sentence), why is "consequence", "audience" or "recovery", and about names the thing the line is about. Each slot renders the content with data-why and data-about, and in development warns once when it is given anything else, which it still renders. ToastDescription, NotificationCenterItemBody, EmptyStateTitle, ListRowDescription and the status and data parts are unchanged.
  • 0.7.0 · FixedEmptyStateIcon is hidden from assistive technology, and NotificationCenterItemIcon is announced as an image named by its status.