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.
Also 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.
When to use
Anatomy
EmptyState: the centered root. Required.EmptyStateContent: groups the icon, title and description. Required.EmptyStateIcon: a Lucide icon, at 36px inforeground-hint. Required.EmptyStateTitle: the title, inforeground-muted. Required.EmptyStateDescription: one helper sentence, inforeground-hint. It takes only aHelperText, made withhelperText(content, { why, about }), and renders itswhyandaboutasdata-whyanddata-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.
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
EmptyStateIconis 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
Also takes the attributes of its element.
EmptyStateDescription
Also takes the attributes of its element.
EmptyStateIcon, EmptyStateTitle
Also takes the attributes of its element.
Related
Changes
- 0.103.0 · Breaking ChangesExplanation slots take only a
HelperText:FieldDescription,FormSection'sdescription, aChoiceListitem'sdescription,SelectItemDescription,DialogDescription,AlertDialogDescription,DrawerDescription,PopoverDescription,EmptyStateDescription,CardDescription,CardFooter,BannerDescription,DialogFooterNote(work in progress),MessageActionCardHint,MessageActionCardHeaderDescription,MessageActionCardScopeDescriptionandMessageActionCardActionsNote. AHelperTextis made only byhelperText(content, { why, about }):contentis anyReactNode(a string, a formatted message, aTextLinkinside a sentence),whyis"consequence","audience"or"recovery", andaboutnames the thing the line is about. Each slot renders the content withdata-whyanddata-about, and in development warns once when it is given anything else, which it still renders.ToastDescription,NotificationCenterItemBody,EmptyStateTitle,ListRowDescriptionand the status and data parts are unchanged. - 0.7.0 · Fixed
EmptyStateIconis hidden from assistive technology, andNotificationCenterItemIconis announced as an image named by its status.