EmptyWithNextStep
An empty page is the start of something: it says what will live here, gives the one thing to do first, and shows the other ways in. Nothing yet, nothing that matches, nothing you may add: three different messages.
import { EmptyState } from '@sypnia/ui/react'
On a desktop
Nothing yet: what a table is for, the first step, and three other ways in.
Tables
Everything this project keeps, as tables.
Your first table goes here
Other ways to start
create table orders (
id bigint primary key generated always as identity,
customer text not null,
total numeric(10,2),
created_at timestamptz default now()
);Code
import { useState, type ReactNode } from 'react';
import {
Button, Card, CodeBlock, EmptyState, Grid, Page, PageHeader, Panel, SearchInput, Section, SkeletonOf, SkeletonWords, Table,
Toolbar, useSypnia,
} from '@sypnia/ui/react';
// An empty page is the start of something: it says what will live here, gives the one thing to do first, and the
// other ways in. Three kinds of empty: nothing yet, nothing that matches a search, and nothing you are allowed to add.
const en = {
page: 'Tables', lead: 'Everything this project keeps, as tables.', create: 'Create a table',
firstTitle: 'Your first table goes here', firstBody: 'A table is where your app keeps one kind of thing: orders, customers, events. Every table gets an API at once.',
import: 'Import a CSV', ways: 'Other ways to start',
template: 'Start from a template', templateText: 'Orders, customers, a blog: tables with their columns ready.',
code: 'From code', codeText: 'Create tables with SQL or the SDK, and they appear here.',
agent: 'With your coding agent', agentText: 'Connect Claude Code or Cursor and ask it for the table you need.',
search: 'Search tables', noMatch: (q: string) => `No table is called «${q}»`, noMatchBody: 'Check the spelling, or search for part of the name.', clear: 'Clear the search',
readTitle: 'No tables yet', readBody: 'You can read this project, but only its owners can create tables. Ask one of them, or ask for edit access.',
ask: 'Ask for edit access', asked: 'Request sent to the owners',
name: 'Name', rows: 'Rows',
};
const es: typeof en = {
page: 'Tablas', lead: 'Todo lo que guarda este proyecto, en tablas.', create: 'Crear una tabla',
firstTitle: 'Aquí va tu primera tabla', firstBody: 'Una tabla es donde tu app guarda un tipo de cosa: pedidos, clientes, eventos. Cada tabla tiene una API al instante.',
import: 'Importar un CSV', ways: 'Otras formas de empezar',
template: 'Empezar con una plantilla', templateText: 'Pedidos, clientes, un blog: tablas con sus columnas listas.',
code: 'Desde el código', codeText: 'Crea tablas con SQL o con el SDK, y aparecen aquí.',
agent: 'Con tu agente de código', agentText: 'Conecta Claude Code o Cursor y pídele la tabla que necesitas.',
search: 'Buscar tablas', noMatch: (q: string) => `Ninguna tabla se llama «${q}»`, noMatchBody: 'Revisa cómo se escribe, o busca una parte del nombre.', clear: 'Borrar la búsqueda',
readTitle: 'Aún no hay tablas', readBody: 'Puedes ver este proyecto, pero solo sus dueños pueden crear tablas. Pídeselo a uno de ellos, o pide permiso para editar.',
ask: 'Pedir permiso para editar', asked: 'Solicitud enviada a los dueños',
name: 'Nombre', rows: 'Filas',
};
const sql = `create table orders (\n id bigint primary key generated always as identity,\n customer text not null,\n total numeric(10,2),\n created_at timestamptz default now()\n);`;
const tables = [{ name: 'orders', rows: 1240 }, { name: 'customers', rows: 312 }, { name: 'invoices', rows: 988 }];
export default function EmptyWithNextStep({ state = 'first' }: { state?: 'first' | 'search' | 'read-only' | 'loading' }) {
const { locale, format } = useSypnia();
const c = locale.startsWith('es') ? es : en;
const [query, setQuery] = useState(state === 'search' ? 'ordrs' : '');
const [asked, setAsked] = useState(false);
// Loading: before the app knows whether there are tables, the page draws what it showed last time (here: nothing
// yet) with every word and button as a skeleton of its own box, so nothing moves when the answer comes.
const loading = state === 'loading';
const words = (n: ReactNode) => (loading ? <SkeletonWords>{n}</SkeletonWords> : n);
const wait = (n: ReactNode) => (loading ? <SkeletonOf>{n}</SkeletonOf> : n);
if (state === 'search') {
const shown = tables.filter((t) => t.name.includes(query.trim().toLowerCase()));
return (
<Page>
<PageHeader title={c.page} lead={c.lead} actions={<Button variant="primary" icon="plus">{c.create}</Button>} />
<Table label={c.page} rows={shown} rowKey={(r) => r.name}
toolbar={<Toolbar label={c.search} start><SearchInput aria-label={c.search} value={query} onChange={(e) => setQuery(e.target.value)} /></Toolbar>}
columns={[{ id: 'name', header: c.name, cell: (r) => r.name }, { id: 'rows', header: c.rows, numeric: true, cell: (r) => format.number(r.rows) }]}
empty={<EmptyState icon="search" compact title={c.noMatch(query)} actions={<Button onClick={() => setQuery('')}>{c.clear}</Button>}>{c.noMatchBody}</EmptyState>} />
</Page>
);
}
if (state === 'read-only') {
return (
<Page>
<PageHeader title={c.page} lead={c.lead} />
<Panel>
<EmptyState icon="lock" title={c.readTitle} actions={<Button icon={asked ? 'check' : 'send'} disabled={asked} onClick={() => setAsked(true)}>{asked ? c.asked : c.ask}</Button>}>{c.readBody}</EmptyState>
</Panel>
</Page>
);
}
return (
<Page>
<PageHeader title={c.page} lead={c.lead} />
<Panel>
<EmptyState icon="table" title={words(c.firstTitle)}
actions={wait(<><Button variant="primary" icon="plus">{c.create}</Button><Button icon="upload">{c.import}</Button></>)}>
{words(c.firstBody)}
</EmptyState>
</Panel>
<Section title={words(c.ways)}>
<Grid min="16rem">
{wait(<Card title={c.template} href="#templates">{c.templateText}</Card>)}
{wait(<Card title={c.agent} href="#connect-agent">{c.agentText}</Card>)}
{wait(<Card title={c.code} href="#docs-sql">{c.codeText}</Card>)}
</Grid>
{wait(<CodeBlock code={sql} lang="sql" title="orders.sql" />)}
</Section>
</Page>
);
} On a phone
At 390 px the ways in stack and the buttons share the width.
Nothing matches
The table stays with its search; the message says what was searched and offers to clear it. Try another word.
Tables
Everything this project keeps, as tables.
No table is called «ordrs»
Nothing you may add
For someone who can read the project but not change it.
Tables
Everything this project keeps, as tables.
No tables yet
Skeleton
Before the app knows whether there are tables: what it showed last time (nothing yet), every word and button as a skeleton of its own box.
Tables
Everything this project keeps, as tables.
When to use it
Use it when
- The first visit to any list: tables, keys, members, deploys.
- A search or filter that matches nothing: say what was searched and offer to clear it.
- A person who can read but not create: say who can, and how to ask.
Do not use it when
- «No data» with nothing to do.
- The same message for «nothing yet» and «nothing matches»: one invites to create, the other to search again.
- More than one primary button: one first step, the rest secondary.
For everyone
- The empty message sits where the list would be, so it is found in the same place.
- Each way in is a link or a button that says what it does: «Create a table», «Import a CSV».
Props
| EmptyState | Type | Default |
|---|---|---|
titlerequiredWhat this place is for, in one sentence of plain language. | ReactNode | |
actionsThe one button that fills it, and at most one alternative. | ReactNode | |
compact | boolean | |
icon | "function" | "error" | "replay" | "performance" | "uptime" | "traces" | "rage-click" | "dead-click" | "alert" | "summary" | "watch" | "sleep" | "light" | "suggestion" | "prompt" | "mcp" | "pull-request" | "git-branch" | "fix" | "check" | "open-source" | "self-host" | "sdk" | "engine" | "signals-in" | "web" | "mobile" | "backend" | "cloud" | "data" | "user" | "clock" | "shield" | "lock" | "mail" | "star" | "copy" | "arrow-right" | "arrow-up-right" | "chevron-down" | "plus" | "close" | "play" | "pause" | "search" | "info" | "warning" | "trash" | "menu" | "download" | "upload" | "filter" | "home" | "table" | "key" | "users" | "sun" | "moon" | "globe" | "sign-out" | "link" | "edit" | "calendar" | "chevron-left" | "chevron-right" | "chevron-up" | "minus" | "more" | "sort" | "arrow-left" | "arrow-up" | "arrow-down" | "arrow-down-right" | "arrow-down-left" | "arrow-up-left" | "swap" | "swap-vertical" | "chevrons-up-down" | "chevrons-left" | "chevrons-right" | "chevrons-down" | "chevrons-up" | "enter" | "undo" | "redo" | "refresh" | "expand" | "collapse" | "fullscreen" | "fullscreen-exit" | "move" | "grip" | "more-vertical" | "trend-up" | "trend-down" | "log-in" | "external" | "slash" | "equal" | "check-small" | "close-small" | "success" | "failure" | "help" | "plus-circle" | "minus-circle" | "ban" | "pending" | "dot" | "dot-off" | "bolt" | "flag" | "pin" | "bookmark" | "heart" | "thumbs-up" | "thumbs-down" | "sparkle" | "target" | "idea" | "award" | "crown" | "bell" | "bell-off" | "bug" | "fire" | "leaf" | "file" | "file-text" | "file-code" | "file-plus" | "file-check" | "file-table" | "file-lock" | "files" | "folder" | "folder-open" | "folder-plus" | "archive" | "clipboard" | "clipboard-check" | "paperclip" | "image" | "save" | "cloud-upload" | "cloud-download" | "cloud-off" | "import" | "export" | "share" | "inbox" | "send" | "box" | "layers" | "tag" | "hash" | "at" | "qr-code" | "book" | "book-open" | "notebook" | "rows" | "columns" | "grid" | "list" | "list-ordered" | "list-checks" | "kanban" | "chart-line" | "chart-bar" | "chart-area" | "chart-parts" | "chart-scatter" | "gauge" | "funnel" | "heatmap" | "sparkline" | "percent" | "sum" | "variable" | "braces" | "brackets" | "null" | "primary-key" | "relation" | "index" | "query" | "backup" | "migrate" | "seed" | "csv" | "json" | "bold" | "italic" | "underline" | "strikethrough" | "heading" | "text" | "paragraph" | "quote" | "code" | "align-left" | "align-center" | "align-right" | "indent" | "outdent" | "unlink" | "scissors" | "eraser" | "highlight" | "duplicate" | "paste" | "wand" | "palette" | "brush" | "ruler" | "crop" | "user-plus" | "user-minus" | "user-check" | "user-x" | "user-circle" | "team" | "organization" | "id-card" | "contact" | "role" | "chat" | "chats" | "comment" | "phone" | "video" | "mic" | "mic-off" | "megaphone" | "rss" | "mail-open" | "handshake" | "wave" | "desktop" | "laptop" | "tablet" | "terminal" | "window" | "browser" | "server" | "cpu" | "memory" | "disk" | "network" | "wifi" | "wifi-off" | "plug" | "power" | "container" | "queue" | "cron" | "webhook" | "api" | "route" | "load-balancer" | "dns" | "domain" | "certificate" | "firewall" | "rocket" | "deploy" | "rollback" | "logs" | "test" | "pipeline" | "commit" | "merge" | "fork" | "release" | "environment" | "region" | "robot" | "agent" | "puzzle" | "credit-card" | "wallet" | "receipt" | "invoice" | "cart" | "bag" | "coins" | "dollar" | "gift" | "plan" | "upgrade" | "usage" | "bank" | "history" | "timer" | "hourglass" | "calendar-check" | "calendar-plus" | "map" | "compass" | "translate" | "accessibility" | "keyboard" | "pointer" | "hand" | "print" | "support" | "stop" | "record" | "skip-forward" | "skip-back" | "fast-forward" | "rewind" | "volume" | "mute" | "camera" | "zoom-in" | "zoom-out" | "eye-off" | "sliders" | "settings" | "toggle" | "sidebar-left" | "sidebar-right" | "panel-bottom" | "split" | "layout" | "dashboard" | "cards" | "density" | "dark-mode" | "theme" | "mouse" | "cursor" | "select" | "picture-in-picture" | "scan" | "unlock" | "shield-off" | "shield-alert" | "shield-user" | "password" | "fingerprint" | "two-factor" | "policy" | "incognito" | "verified" | "audit" | "secret" | "p-telemetry" | "p-cases" | "p-agent" | "p-git" | "p-data" | "p-files" | "p-run" | "p-ai" | "p-mail" | "p-domains" | "p-design" | "p-learn" | "p-skills" | "p-app" | "p-ui" | light |
tone | "fail" | "neutral" | neutral |