Status
Shows where a task, run, or step stands: pending, running, paused, succeeded, warning, failed, stopped, or skipped. Running fills eight segments as a known amount grows, or spins like Spinner when the amount is unknown. For a page-level wait, use Progress or Spinner.
Installation
pnpm dlx shadcn@latest add https://sprout.tulipfarm.ai/r/status.jsonCopies Status and the components it uses (status-tooltip) into your app, installs the packages, and adds the styles. Then import it from @/components/ui/status. Needs Tailwind CSS 4 and a components.json from shadcn init.
Install the following dependencies:
pnpm add clsx tailwind-mergeAdd Sprout base once per app: the
cn()helper and the design tokens.lib/sprout/classes.ts- Design tokens, for your global CSS
Add the components it uses: status-tooltip.
Copy and paste the following code into your project.
'use client'; import { lazy, Suspense, useRef, useState, type ComponentProps, type PointerEvent, type ReactNode } from 'react'; import { cn } from '@/lib/sprout/classes'; const StatusTooltip = lazy(() => import('@/components/ui/status-tooltip')); export const statusStateNames = [ 'pending', 'running', 'paused', 'success', 'warning', 'error', 'stopped', 'skipped', ] as const; export type StatusState = (typeof statusStateNames)[number]; export const statusSizeNames = ['sm', 'md', 'lg'] as const; export type StatusSize = (typeof statusSizeNames)[number]; export interface StatusProps extends Omit<ComponentProps<'span'>, 'children' | 'color'> { state?: StatusState | undefined; value?: number | null | undefined; size?: StatusSize | undefined; tooltip?: ReactNode; } const stateLabels = { pending: 'Pending', running: 'Running', paused: 'Paused', success: 'Succeeded', warning: 'Warning', error: 'Failed', stopped: 'Stopped', skipped: 'Skipped', } as const satisfies Record<StatusState, string>; const statusSegments = 8; const clampValue = (value: number | null | undefined) => typeof value === 'number' && Number.isFinite(value) ? Math.min(100, Math.max(0, value)) : null; export function Status({ state = 'pending', value, size = 'md', className, role = 'img', 'aria-label': label, 'aria-hidden': hidden, tooltip, ref, onPointerEnter, onPointerLeave, onFocus, onBlur, ...rest }: StatusProps) { const anchor = useRef<HTMLSpanElement | null>(null); const [tipOpen, setTipOpen] = useState(false); const [tipLoaded, setTipLoaded] = useState(false); const amount = state === 'running' ? clampValue(value) : null; const determinate = amount !== null; const decorative = hidden === true || hidden === 'true'; const name = label ?? (determinate ? `${stateLabels.running}, ${Math.round(amount)}%` : stateLabels[state]); const mark = determinate ? 'progress' : state; const tip = tooltip === undefined ? name : tooltip; const hasTip = tip != null && tip !== false && tip !== ''; const showTip = (open: boolean) => { if (!hasTip) return; if (open) setTipLoaded(true); setTipOpen(open); }; const glyph = ( <span data-slot="status" data-state={state} data-size={size} {...(determinate ? { 'data-determinate': '' } : {})} {...(decorative ? { 'aria-hidden': 'true' as const } : { role, 'aria-label': name })} className={cn('sprout-status', `sprout-status-size-${size}`, className)} {...rest} ref={node => { anchor.current = node; if (typeof ref === 'function') return ref(node); if (ref) ref.current = node; }} onPointerEnter={event => { onPointerEnter?.(event); replayGlyph(event); if (event.pointerType === 'mouse') showTip(true); }} onPointerLeave={event => { onPointerLeave?.(event); showTip(false); }} onFocus={event => { onFocus?.(event); if (event.currentTarget.matches(':focus-visible')) showTip(true); }} onBlur={event => { onBlur?.(event); showTip(false); }} > <svg key={mark} className="sprout-status-mark" data-mark={mark} viewBox="0 0 20 20" fill="none" aria-hidden="true" focusable="false" > <StatusMark mark={mark} amount={amount ?? 0} /> </svg> </span> ); return ( <> {glyph} {hasTip && tipLoaded && ( <Suspense fallback={null}> <StatusTooltip anchor={anchor} open={tipOpen} onOpenChange={setTipOpen}> {tip} </StatusTooltip> </Suspense> )} </> ); } const replayEasing = 'cubic-bezier(0.2, 0.8, 0.2, 1)'; function replayGlyph(event: PointerEvent<HTMLSpanElement>) { if (event.pointerType !== 'mouse') return; const root = event.currentTarget; if (typeof root.animate !== 'function' || matchMedia('(prefers-reduced-motion: reduce)').matches) return; for (const glyph of root.querySelectorAll('.sprout-status-glyph')) glyph.animate([{ strokeDashoffset: 1 }, { strokeDashoffset: 0 }], { duration: 320, easing: replayEasing }); for (const dot of root.querySelectorAll('.sprout-status-dot')) dot.animate( [ { opacity: 0, transform: 'scale(0.4)' }, { opacity: 1, transform: 'scale(1)' }, ], { duration: 220, delay: 120, easing: replayEasing, fill: 'backwards', }, ); } function StatusMark({ mark, amount }: { mark: StatusState | 'progress'; amount: number }) { switch (mark) { case 'progress': { const done = Math.floor(amount / (100 / statusSegments)); return ( <g className="sprout-status-segments"> {Array.from({ length: statusSegments }, (_, index) => ( <circle key={index} className="sprout-status-segment" data-segment={index < done ? 'done' : index === done ? 'active' : 'todo'} cx="10" cy="10" r="8" pathLength={40} strokeDasharray="2 38" strokeDashoffset={-(index * 5 + 1.5)} /> ))} </g> ); } case 'running': return ( <> <circle className="sprout-status-track" cx="10" cy="10" r="8" /> <g className="sprout-status-spin"> <circle className="sprout-status-arc" cx="10" cy="10" r="8" pathLength={100} strokeDasharray="28 72" /> </g> </> ); case 'pending': return <circle className="sprout-status-ring" cx="10" cy="10" r="8" />; case 'paused': return ( <> <circle className="sprout-status-ring" cx="10" cy="10" r="8" /> <path className="sprout-status-glyph" d="M8.25 7.25v5.5M11.75 7.25v5.5" pathLength={1} /> </> ); case 'skipped': return ( <> <circle className="sprout-status-ring" cx="10" cy="10" r="8" /> <path className="sprout-status-glyph" d="M13 7 7 13" pathLength={1} /> </> ); case 'success': return ( <> <circle className="sprout-status-fill" cx="10" cy="10" r="9" /> <path className="sprout-status-glyph" d="m6.1 10.3 2.6 2.6 5.2-5.6" pathLength={1} /> </> ); case 'warning': return ( <> <circle className="sprout-status-fill" cx="10" cy="10" r="9" /> <path className="sprout-status-glyph" d="M10 5.9v4.6" pathLength={1} /> <circle className="sprout-status-dot" cx="10" cy="13.7" r="1.15" /> </> ); case 'error': return ( <> <circle className="sprout-status-fill" cx="10" cy="10" r="9" /> <path className="sprout-status-glyph" d="m7.2 7.2 5.6 5.6m0-5.6-5.6 5.6" pathLength={1} /> </> ); case 'stopped': return ( <> <circle className="sprout-status-fill" cx="10" cy="10" r="9" /> <rect className="sprout-status-dot" x="7" y="7" width="6" height="6" rx="1.25" /> </> ); } }Add the styles to your global CSS, after
@import "tailwindcss".@layer components { .sprout-status { --sprout-status-color: var(--sprout-muted); width: 16px; height: 16px; color: var(--sprout-status-color); vertical-align: -.1875em; flex-shrink: 0; display: inline-flex; } .sprout-status-size-sm { width: 12px; height: 12px; } .sprout-status-size-lg { width: 20px; height: 20px; } .sprout-status[data-state="running"] { --sprout-status-color: var(--sprout-info); } .sprout-status[data-state="running"][data-determinate], .sprout-status[data-state="success"] { --sprout-status-color: var(--sprout-success); } .sprout-status[data-state="warning"] { --sprout-status-color: var(--sprout-warning); } .sprout-status[data-state="error"] { --sprout-status-color: var(--sprout-danger); } .sprout-status-mark { transform-origin: center; width: 100%; height: 100%; display: block; overflow: visible; } .sprout-status-ring, .sprout-status-track, .sprout-status-arc, .sprout-status-segment { stroke-width: 2px; } .sprout-status-ring { stroke: color-mix(in oklab, currentColor 72%, transparent); } .sprout-status-track { stroke: color-mix(in oklab, currentColor 22%, transparent); } .sprout-status-arc, .sprout-status-segment { stroke: currentColor; stroke-linecap: round; } .sprout-status-segment[data-segment="todo"] { stroke: color-mix(in oklab, var(--sprout-muted) 30%, transparent); } .sprout-status-segments, .sprout-status-spin { transform-box: view-box; transform-origin: 50%; transform: rotate(-90deg); } .sprout-status-fill { fill: currentColor; } .sprout-status-glyph { stroke: var(--sprout-surface); stroke-width: 2px; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; } .sprout-status-mark[data-mark="paused"] .sprout-status-glyph, .sprout-status-mark[data-mark="skipped"] .sprout-status-glyph { stroke: currentColor; } .sprout-status-dot { fill: var(--sprout-surface); transform-box: fill-box; transform-origin: center; } @media (prefers-reduced-motion: no-preference) { .sprout-status-mark { animation: sprout-status-enter .28s var(--sprout-motion-ease) backwards; transition: transform var(--sprout-motion-normal) var(--sprout-motion-ease); } .sprout-status-glyph { animation: sprout-status-draw .3s var(--sprout-motion-ease) 90ms backwards; } .sprout-status-dot { animation: sprout-status-pop .22s var(--sprout-motion-ease) .16s backwards; } .sprout-status-ring { transition: stroke var(--sprout-motion-normal) ease; } .sprout-status-segment { transition: stroke var(--sprout-motion-normal) var(--sprout-motion-ease); } .sprout-status-segment[data-segment="active"] { animation: 1.4s ease-in-out infinite alternate sprout-status-fade-cycle; } .sprout-status-spin { animation: 1s linear infinite sprout-status-spin; } @media (hover: hover) and (pointer: fine) { .sprout-status:hover .sprout-status-mark { transform: scale(1.15); } .sprout-status:hover .sprout-status-ring { stroke: currentColor; } } } @media (prefers-reduced-motion: reduce) { .sprout-status-mark { animation: .16s ease-out backwards sprout-status-fade; } .sprout-status-segment[data-segment="active"] { opacity: .55; } } @media (forced-colors: active) { .sprout-status { --sprout-status-color: CanvasText; } .sprout-status[data-state="running"] { --sprout-status-color: Highlight; } .sprout-status-ring, .sprout-status-track, .sprout-status-segment[data-segment="todo"] { stroke: graytext; } .sprout-status-glyph { stroke: canvas; } .sprout-status-dot { fill: canvas; } } @keyframes sprout-status-enter { from { opacity: 0; transform: scale(.6); } } @keyframes sprout-status-draw { from { stroke-dashoffset: 1px; } } @keyframes sprout-status-pop { from { opacity: 0; transform: scale(.4); } } @keyframes sprout-status-fade { from { opacity: 0; } } @keyframes sprout-status-fade-cycle { from { opacity: .25; } to { opacity: 1; } } @keyframes sprout-status-spin { from { transform: rotate(-90deg); } to { transform: rotate(270deg); } } }Import it from
@/components/ui/status. Update the paths if your@/alias points elsewhere.
pnpm add @tulipfarm/sprout@import "tailwindcss";
@import "@tulipfarm/sprout/styles.css";The package keeps the source and ships fixes with each release. Import from @tulipfarm/sprout/status.
States
Eight states, and running with or without a known amount. Hover a mark to replay it. Each size matches Spinner: 12, 16, and 20px.
- PendingQueued, not started
- RunningAmount unknown
- Running, 40%Amount known
- PausedWaiting to resume
- SucceededFinished
- WarningFinished with issues
- FailedNeeds attention
- StoppedCancelled by someone
- SkippedDid not need to run
Change state
The mark animates in again whenever its state changes. A changing amount only fills the next segment.
Deploy run
Each step’s mark follows the run: pending, running with or without an amount, then its result. Stop the run to see stopped and skipped.
Ready to deploy
- Install dependenciesQueued
- Build web appQueued
- Run 1,284 testsQueued
- Migrate databaseQueued
- Deploy to productionQueued
Usage
import { Status } from "@tulipfarm/sprout/status";
<Status state="pending" />
<Status state="running" />
<Status state="running" value={40} />
<Status state="success" />
<Status state="error" size="lg" />state:pending(default),running,paused,success,warning,error,stopped, orskipped.value: forrunning, a number from 0 to 100 fills a ring of eight green segments, one per 12.5%, and the segment being worked on fades in and out. Leave it out (or passnull) while the amount is unknown, and a blue line runs around the ring at the same speed as Spinner.size:sm(12px),md(16px, default), orlg(20px).tooltip: shown on hover. Defaults to the state’s name, such as “Succeeded” or “Running, 40%”. Pass your own words, such astooltip="Access denied", orfalsefor none.
The root gets data-state, data-size, and data-determinate while a running amount is known.
Motion
The mark scales in over 280ms when it mounts, and again whenever its state changes; the check, cross, or bar then draws in. A changing amount only fills the next segment, over 180ms. On hover with a mouse, the mark grows a little and its glyph draws again. With reduced motion, the mark only fades in, the line rests at the top, and the active segment stays half lit instead of fading.
Accessibility
Status is an img named after its state, such as “Succeeded” or “Running, 40%”. Pass aria-label to name it yourself, or aria-hidden="true" when text beside it already says the state. It is not a live region; put a role="status" summary nearby when a change should be announced. Color is never the only signal: each state has its own shape.
Theme tokens
Running uses --sprout-info, a known amount and success --sprout-success, warning --sprout-warning, and error --sprout-danger. Pending, paused, stopped, and skipped use --sprout-muted. Glyphs on a filled circle use --sprout-surface. In forced colors, the mark uses CanvasText, and running uses Highlight.