Status
A small light and a word that answer one question: is this thing well right now?
import { Status, StatusSkeleton } from '@sypnia/ui/react'
Tones
Healthy, slow, down, deploying, paused and the lit one.
HealthySlowDownDeployingPausedSelected
Code
import { Status } from '@sypnia/ui/react';
export default function Tones() {
return (
<div className="sy-row">
<Status tone="ok">Healthy</Status>
<Status tone="warn">Slow</Status>
<Status tone="fail">Down</Status>
<Status tone="info">Deploying</Status>
<Status>Paused</Status>
<Status tone="lit">Selected</Status>
</div>
);
} Happening now
The light breathes while orders keep arriving.
Receiving orders1,204 rows
Code
import { useEffect, useState } from 'react';
import { Status } from '@sypnia/ui/react';
// `live` makes the light breathe: something is happening right now.
export default function Live() {
const [rows, setRows] = useState(1204);
useEffect(() => { const t = setInterval(() => setRows((r) => r + 1), 2400); return () => clearInterval(t); }, []);
return (
<div className="sy-row">
<Status tone="ok" live>Receiving orders</Status>
<span className="sy-text--sm sy-num sy-text--soft">{rows.toLocaleString('en')} rows</span>
</div>
);
} Down a column
The states of several services, easy to compare.
Services
DatabaseHealthy
APIHealthy
RealtimeSlow: 420 ms
BackupsLast run failed
Code
import { Panel, Status } from '@sypnia/ui/react';
const services = [['Database', 'ok', 'Healthy'], ['API', 'ok', 'Healthy'], ['Realtime', 'warn', 'Slow: 420 ms'], ['Backups', 'fail', 'Last run failed']] as const;
export default function InAList() {
return (
<Panel title="Services">
<div className="sy-stack">
{services.map(([name, tone, text]) => (
<div key={name} className="sy-row sy-row--between"><span className="sy-text--sm">{name}</span><Status tone={tone}>{text}</Status></div>
))}
</div>
</Panel>
);
} Skeleton
The real piece and its skeleton: the same box, so nothing moves when the data arrives.
Running
Code
import { Status, StatusSkeleton } from '@sypnia/ui/react';
// The light stays off until the state is known. The skeleton has the same box as the real one, so nothing moves when the data arrives.
export default function Skeleton() {
return (
<div className="sy-stack">
<Status tone="ok">Running</Status>
<StatusSkeleton />
</div>
);
} When to use it
Use it when
- The health of something that runs: a service, a connection, a deployment.
- Lists and tables where the state must be compared down a column.
- Add
livewhen it is happening this moment: the light breathes.
Do not use it when
- The state is a step in a process (Paid, Draft): that is a Badge.
- There is a problem to solve: an Alert says what to do.
- You would show the light without the word.
For everyone
- The word carries the meaning; the light only repeats it.
- The breathing light stops for people who ask their device for less motion.
- It is plain text. If it changes while the person watches and they must know, put it in a live region.
Props
| Status | Type | Default |
|---|---|---|
live | boolean | |
tone | "info" | "ok" | "warn" | "fail" | "neutral" | "lit" | neutral |