Skip to content

ErrorState

What a region shows when its content could not be loaded: what happened, in plain words, and a button to try again.

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

On this page
  1. A region that failed
  2. A whole page
  3. No permission
  4. When to use it
  5. For everyone
  6. Props

A region that failed

Press «Try again»: the button works and the content arrives.

Usage this month

Code
import { useState } from 'react';
import { Button, EmptyState, KeyValue, Panel } from '@sypnia/ui/react';

// Press «Try again»: the region loads and shows its content.
export default function Region() {
  const [state, setState] = useState<'failed' | 'trying' | 'ready'>('failed');
  const retry = () => { setState('trying'); setTimeout(() => setState('ready'), 1800); };
  return (
    <Panel title="Usage this month" actions={state === 'ready' && <Button size="sm" onClick={() => setState('failed')}>Fail again</Button>}>
      {state === 'ready'
        ? <KeyValue items={[['Requests', '482,110'], ['Storage', '3.1 GB of 5 GB'], ['Team', '4 of 5 members']]} />
        : (
          <EmptyState tone="fail" compact title="The usage could not be loaded"
            actions={<Button busy={state === 'trying'} onClick={retry}>{state === 'trying' ? 'Loading…' : 'Try again'}</Button>}>
            The server took too long to answer. Your data is safe.
          </EmptyState>
        )}
    </Panel>
  );
}

A whole page

What happened, who did it, and two ways out.

Code
import { Button, EmptyState } from '@sypnia/ui/react';

// When the whole view fails: what happened, what the person can do, and a way out.
export default function WholePage() {
  return (
    <EmptyState tone="fail" title="This table no longer exists"
      actions={<><Button variant="primary" href="#">See all tables</Button><Button href="#">Open the activity log</Button></>}>
      <span className="sy-machine">order_drafts</span> was deleted by Diego Ruiz on November 12. Its rows are in the backups for 7 more days.
    </EmptyState>
  );
}

No permission

A lock says more than the general error mark.

Code
import { Button, EmptyState } from '@sypnia/ui/react';

// Another icon when it says more than the general one: here, a lock.
export default function OwnIcon() {
  return (
    <EmptyState tone="fail" icon="lock" title="You cannot see the billing of this project" actions={<Button icon="mail">Ask the owner</Button>}>
      Only the owner, Laura Méndez, can open it.
    </EmptyState>
  );
}

When to use it

Use it when

  • A panel, a table or a page failed to load.
  • Always give a way forward: try again, go somewhere that works, or ask someone.
  • Say whether the person’s data is safe when they might worry.

Do not use it when

  • An action failed (saving, deleting) and the content is still on screen: Alert, next to the action.
  • One field is wrong: the error goes in its Field.
  • There is simply nothing yet: that is the normal EmptyState.

For everyone

  • It is announced at once (role="alert"), because the person was waiting for content that is not coming.
  • The icon changes to the error mark and the ring turns red; the title carries the meaning in words.
  • Do not show raw error codes alone. If a code helps support, put it after the explanation.

Props

EmptyStateTypeDefault
titlerequired

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. A region that failed
  2. A whole page
  3. No permission
  4. When to use it
  5. For everyone
  6. Props

    Search pages, sections and terms