Empty State
Fills a region that has no content yet, says why, and points to the next step.
Ritla scan of this preview: 41 of 41 checks3 breakpointsScanned
Preview
Mirrored is the same English content laid out right to left: it separates a mirroring bug from a translation one.
Installation
Add the component
npx ritla add emptyAlso works with shadcn:
npx shadcn@latest add @ritla/emptyOr copy by hand
Installing by hand copies the component's source into your project. The source comes with a Ritla UI license, so the CLI is the short way to the same files.
Usage
import { Empty } from "@/components/ui/empty";<Empty illustration="no-transactions" title="No transactions yet" description="When you send or receive money, it will show up here." primary={{ label: "Add money", href: "/add-money" }}/>Examples
No results
No results isn't first use: it repeats the search, offers Clear search, and is announced (announce="status") while focus stays in the field. Change the search to see the list.
Couldn't load
Say what went wrong in plain words and offer Try again.
Compact, in a card
size="compact" for small regions: no illustration, a smaller title, the action.
Stacked actions
stacking="vertical" for long labels, primary on top.
Illustrations
Figma's Empty state illustrations in token colors, so they follow dark mode and the brand mode. Pick the one that matches the content with subject; never recolor or crop one. They are drawn for Arabic, so they show as drawn there and mirror in English, the tick kept upright. 160 by default; <EmptyIllustration size={240} /> for large regions.
API reference
Empty
| Prop | Type | Default | Description |
|---|---|---|---|
illustration | EmptyIllustrationSubject | ReactNode | None | Figma's Empty state illustration slot: a subject (drawn at 160) or any node. |
title | ReactNode | None | Figma's Title: what's missing; a heading. |
description | ReactNode | None | Figma's Description: what will appear here, or how to fill it. |
headingLevel | 2 | 3 | 4 | 5 | 6 | 3 | The title's heading level. |
primary / secondary | { label; href?; render?; onClick? } | None | The primary (Filled) and secondary (Tonal) actions. |
stacking | "horizontal" | "vertical" | "horizontal" | Figma's Stacking. |
size | "default" | "compact" | "default" | compact for cards and small regions. |
announce | "status" | None | For no-results messages after a search or filter. |
EmptyIllustration
| Prop | Type | Default | Description |
|---|---|---|---|
subject | EmptyIllustrationSubject | None | Figma's Subject: what is missing ("no-transactions"). Always decorative. |
size | 160 | 240 | 160 | Figma's Size. |
mirror | boolean | true | Flips the drawing in left-to-right pages, since it is drawn for Arabic. |
Accessibility
Keyboard
Keys are written for left-to-right. In right-to-left the arrow keys swap: the one pointing toward the reading direction moves forward.
| Key | Action |
|---|---|
| Tab | To the primary action, then the secondary. |
ARIA
- The title is a real heading (
h3by default) so screen readers can find it. - Illustrations are decorative and hidden from screen readers; the explanation is never only in the picture.
- No-results messages are announced with
status; focus stays where it was and never jumps to them.
Arabic and RTL notes
Mirrors
- The text stays centered and the primary action comes first: on the right.
- The illustration is drawn for Arabic (Figma: "RTL by default"): the hard shadow to the left, the disc at the end. In English the whole drawing mirrors.
Does not mirror
- A tick inside an illustration stays upright when the drawing mirrors.
- Numerals
- Numbers in the description follow the numerals setting; format them with
formatNumber. - Arabic typography
- Title
body-20Medium (body-16when compact), descriptionbody-14. - Mixed-direction text
- What the person searched for goes in
<bdi>, since it can be in either language.
Checks it passes
The Ritla checks this component satisfies by construction. Used as documented, it does not bring these defects onto your page.
- text-align: left explicitly set on majority-Arabic text
- Clipped text: content wider than its box with overflow hidden and no ellipsis
- Fixed-pixel-width container whose Arabic text exceeds the space
- Arabic text falling back past the declared font family (measured, declared, or a webfont that failed to load)
- letter-spacing applied to Arabic text (breaks the connected script)