Ir al contenido

EmptyState

Lo que muestra un lugar cuando todavía no tiene nada: una frase que dice qué va aquí, y el botón que pone lo primero.

import { EmptyState } from '@sypnia/ui/react'

En esta página
  1. Con el paso siguiente
  2. No se encontró nada
  3. En regiones pequeñas
  4. Cuándo usarlo
  5. Para todos
  6. Props

Con el paso siguiente

Qué va aquí, y las dos formas de empezar.

This project has no tables yet

A table holds rows of the same kind of thing: orders, customers, products.
Código
import { Button, EmptyState } from '@sypnia/ui/react';

// What goes here, in one sentence, and the button that fills it.
export default function NextStep() {
  return (
    <EmptyState icon="table" title="This project has no tables yet"
      actions={<><Button variant="primary" icon="plus">Create table</Button><Button icon="upload">Import a CSV file</Button></>}>
      A table holds rows of the same kind of thing: orders, customers, products.
    </EmptyState>
  );
}

No se encontró nada

La frase repite lo que se buscó; el botón lo borra.

Customers

No customer matches «laura@northwnd.io»

Check the spelling or search by order number.
Código
import { useState } from 'react';
import { Button, EmptyState, Panel, SearchInput } from '@sypnia/ui/react';

// A search with no results is not an empty place: say what was searched and how to get back.
export default function NoResults() {
  const [q, setQ] = useState('laura@northwnd.io');
  return (
    <Panel title="Customers" actions={<SearchInput size="sm" aria-label="Search customers" value={q} onChange={(e) => setQ(e.target.value)} />}>
      {q
        ? <EmptyState compact icon="search" title={`No customer matches «${q}»`} actions={<Button onClick={() => setQ('')}>Clear the search</Button>}>Check the spelling or search by order number.</EmptyState>
        : <p className="sy-text--sm sy-text--soft">418 customers. Type to search.</p>}
    </Panel>
  );
}

En regiones pequeñas

Dos paneles todavía vacíos.

Webhooks

No webhooks

Add one to tell your server when an order changes.

Activity

Nothing has happened today

Código
import { EmptyState, Panel } from '@sypnia/ui/react';

// `compact` for small regions: a panel, a column, a tab.
export default function Compact() {
  return (
    <div className="sy-cols sy-cols--stack">
      <Panel title="Webhooks"><EmptyState compact icon="link" title="No webhooks">Add one to tell your server when an order changes.</EmptyState></Panel>
      <Panel title="Activity"><EmptyState compact icon="clock" title="Nothing has happened today" /></Panel>
    </div>
  );
}

Cuándo usarlo

Úsalo cuando

  • Una lista, una tabla o una página todavía no tiene contenido: di para qué es y ofrece el primer paso.
  • Una búsqueda o un filtro no encontró nada: di qué se buscó y cómo volver.
  • Regiones pequeñas: agrega compact.

No lo uses cuando

  • El contenido está cargando: muestra su skeleton.
  • Falló la carga: ese es el estado de error (tone="fail").
  • Tendría tres botones o más. Un paso principal y como mucho una alternativa.

Para todos

  • El título es el mensaje: escríbelo como una frase completa en palabras simples.
  • El icono es decoración y está oculto para los lectores de pantalla.
  • Los botones son botones normales en el orden de Tab; el principal va primero.

Props

EmptyStateTipoPor defecto
titleobligatorio

What this place is for, in one sentence of plain language.

ReactNode
actions

The 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
  1. Con el paso siguiente
  2. No se encontró nada
  3. En regiones pequeñas
  4. Cuándo usarlo
  5. Para todos
  6. Props

    Busca páginas, secciones y términos