Usage
import { EmptyStates } from './EmptyStates.jsx'
// Show one scene where a list is empty, or all four as a reference. Wire the actions:
<EmptyStates
locale="en"
defaultScene="search"
onAction={async (scene, which) => {
if (scene === 'search' && which === 'primary') clearFilters()
if (scene === 'offline' && which === 'primary') return await reconnect() // false keeps the scene as it was
}}
/>Props
| Prop | Type | Default | What it does |
|---|---|---|---|
locale | 'en' | 'zh-CN' | 'es' | 'ja' | 'en' | Language of the built-in text. |
scenes | Array<{ id: 'first' | 'search' | 'offline' | 'locked', tab, title, text, primary, secondary?, done? }> | the four scenes | The scenes as tabs, in order; the id picks the picture and the action icon. |
defaultScene | string | 'first' | The scene shown first. |
onAction | (scene, 'primary' | 'secondary') => Promise<boolean | void> | void | — | An action was pressed. For the primary one, resolve false to skip the confirmation line. |
onChange | (scene) => void | — | Another tab was chosen. |
labels | object | — | Replaces any built-in text (keys as in copy.js). |
className | string | — | Added to the root section. |
Add it to your project
Copy the prompt into Codex or Claude Code. The agent reads the published source, shows you what it will write and adds the block together with the components it is built from.
EmptyStates.jsxempty-states.csscopy.jskit.jsxkit.cssui/base-button/ui/sliding-tabs/tokens.cssREADME.md
The block, its stylesheet and text, the shared kit, the components it uses and tokens.css install together into one folder.