aiellie

Search

Find a component, template or page

GitHub
Design

Status

A labelled state pill with an optional pulsing indicator.

DeployingDeployedFailedNeeds approvalQueued
Open full screen
fig. 01 · open it full screen from the corner

Installation

npx shadcn@latest add "@aiellie/status"

shadcn needs the @aiellie registry in components.json first. npx aiellie add status adds it on its first run, then installs the same way.

Status is a small pill that says what state something is in: live, done, failed, waiting on you, or idle. A dot leads the word, pulsing while the thing is still going, and the pill takes a tint of the state's color. The word is always there, so the state never rests on color alone.

Getting started

  1. Add a status

    Compose it from its dot and its label.

    components/deploy-status.tsx
    import {
      Status,
      StatusIndicator,
      StatusLabel,
    } from "@/components/ui/status"
    
    export function DeployStatus({ running }: { running: boolean }) {
      return (
        <Status variant={running ? "live" : "success"} pulse={running}>
          <StatusIndicator />
          <StatusLabel>{running ? "Deploying" : "Deployed"}</StatusLabel>
        </Status>
      )
    }

Anatomy

<span data-slot="status" data-variant="live" data-pulse="true"> {/* render, a span by default */}
  <span data-slot="status-indicator"> {/* a 6px dot, with a ring and a ping while pulsing */}
  <span data-slot="status-label" />
</span>

The pill is 12px text in the state's color on a 4% tint of it, with a hairline border. live, success and pending use the aiellie theme's tokens of those names, and destructive uses shadcn's. pending is amber, for something waiting on the person, like an approval; it never pulses. Anything else, like queued, draft or idle, is muted: neutral, on a muted fill. The ping stops with reduced motion, and the dot stays.

Use pulse for something still running, and leave it off once it has finished. statusVariants is exported for a pill of your own that should look the same.

Examples

A task's state

Neutral while queued, pulsing while it runs, amber while it waits on you, and still once it has an outcome.

Running

As a link

render makes the pill another element, like a link to the status page.

<Status variant="destructive" render={<a href="https://status.example.com" />}>
  <StatusIndicator />
  <StatusLabel>Degraded</StatusLabel>
</Status>

API reference

Status

PropTypeDefaultDescription
variant"live" | "success" | "destructive" | "pending" | "muted""live"The state, and its color.
pulsebooleanfalsePings the dot, for something still going.
renderReactElement<span />The element it renders as.
classNamestringMerged onto the pill.

Parts

ExportRendersNotes
StatusIndicatorspanThe dot, in the state's color.
StatusLabelspanThe word, truncated when there's no room.
statusVariantscvaThe pill's classes by variant.