Skip to content
Star

Status pill

One live line for what the agent is doing right now. Free and MIT licensed, as HTML, a typed React component or an Astro component, in three styles with light and dark mode.

$npx designme add status-pill
$npx shadcn@latest add https://designme.dev/r/shadcn/status-pill.json

Need this designed into your product? Book a call

01

Install

Add it to your project with the CLI.

HTML, CSS and JS

$npx designme add status-pill

React

$npx designme add status-pill --react

Astro

$npx designme add status-pill --astro

shadcn, React

$npx shadcn@latest add https://designme.dev/r/shadcn/status-pill.json

shadcn, Astro

$npx shadcn@latest add https://designme.dev/r/shadcn/astro/status-pill.json

The CLI copies the source into your project, so you own it and can change anything. Where each version lands, what it needs and the shadcn theme bridge: Installation.

02

About

What it is for and what it does.

Status pill is a single line that tells people what the agent is doing right now, such as thinking, reading files or waiting for approval. It fades between states and resizes to fit the new text, and it can hold a button for the moment the agent needs a person.

  • When people need a glanceable signal of the agent's current step, in a header, a chat footer or over a canvas.
  • When the agent pauses for approval and you want a Review button right where people are already looking.
  • When a task reports small counts like "2 of 4" that tick over without restarting the line.
  • When you want a slim progress track under the status in a wider bar.
03

Usage

Import it in React and drive it from your own state, or place it in an Astro page.

React

import { StatusPill } from '@/components/designme/status-pill/StatusPill';

React example

The demo above as a React component, 35 lines you can copy.

'use client';
// The animated preview from designme.dev, rebuilt from the React component: an example of driving it from your own state.
import { useRef, useState } from 'react';
import { StatusPill, type StatusPillProps } from './StatusPill';
import { Seg } from '../lib/motion';
import { Demo } from '../lib/Demo';
import { useScript, useTakeover } from '../lib/useScript';

/* ---------- Status pill: an agent run from thinking to done, waiting for Review on the way ---------- */
export default function StatusPillDemo() {
  const [variant, setVariant] = useState<'pill' | 'bar'>('pill');
  const [p, setP] = useState<StatusPillProps>({ state: 'idle', label: 'Ready for a task' });
  const ref = useRef<HTMLDivElement>(null), mine = useTakeover(ref);
  useScript(async ({ wait }) => {
    for (;;) {
      await wait(1100);
      setP({ state: 'thinking', label: 'Thinking', progress: 8 }); await wait(1800);
      setP({ state: 'reading', label: 'Reading Figma frames', meta: '1 of 4', progress: 22 }); await wait(400);
      for (let i = 2; i <= 4; i++) { await wait(650); setP({ state: 'reading', label: 'Reading Figma frames', meta: `${i} of 4`, progress: 22 + i * 8 }); }
      await wait(700);
      setP({ state: 'working', label: 'Editing', file: { name: 'PricingCard.tsx', type: 'tsx' }, progress: 64 }); await wait(2000);
      // waits for Review, and carries on by itself after a while so the loop never stalls; once you have taken over, it waits for you
      await new Promise<void>(res => { setP({ state: 'waiting', label: 'Waiting for your approval', action: { label: 'Review', onClick: res }, progress: 72 }); wait(8000).then(() => { if (!mine()) res(); }); });
      setP({ state: 'working', label: 'Applying 4 changes', progress: 88 }); await wait(1600);
      setP({ state: 'done', label: 'Done', meta: '4 files changed', progress: 100 }); await wait(3200);
      setP({ state: 'idle', label: 'Ready for a task', progress: 0 });
    }
  });
  return (
    <Demo ref={ref} switcher={<Seg label="Variant" value={variant} onChange={setVariant} options={[{ value: 'pill', label: 'Pill' }, { value: 'bar', label: 'Bar' }]} />}>
      <StatusPill {...p} variant={variant} />
    </Demo>
  );
}

Astro

In a page in src/pages. It plays the demo above; change its status-pill.js to show your own data. Attributes like class go on its root element.

---
import StatusPill from '../components/designme/status-pill/StatusPill.astro';
---
<StatusPill />
<StatusPill data-style="soft" class="my-class" />
04

Props

Everything StatusPill takes.

PropTypeWhat it does
stateStatusPillStatePicks the glyph and colour. thinking, reading and working shimmer while they run
labelrequiredstringWhat the agent is doing, in a few words
metastringQuiet detail after the label, like "2 of 4". Changing only this does not restart the pill
file{ name: string; type?: string }A file chip after the label, like { name: 'PricingCard.tsx', type: 'tsx' }
action{ label: string; onClick: () => void }A button at the end, for when the agent needs the person
progressnumber0 to 100, drawn as a track along the bottom of the bar variant
variant'pill' | 'bar'pill hugs its content, bar is taller and leaves room for the progress track
classNamestring
05

Code

The full source, as the CLI installs it.

StatusPill.tsxReact · 111 lines
'use client';
import { useEffect, useRef, useState } from 'react';
import { cx } from '../lib/cx';
import { useIsoLayoutEffect, useReducedMotion } from '../lib/hooks';
import { Icon } from '../lib/icons';
import { Dot, Radar, Spin, Think } from '../lib/motion';
import '../designme.css';
import './status-pill.css';

export type StatusPillState = 'idle' | 'thinking' | 'reading' | 'working' | 'waiting' | 'done';

export interface StatusPillProps {
  /** Picks the glyph and colour. thinking, reading and working shimmer while they run */
  state?: StatusPillState;
  /** What the agent is doing, in a few words */
  label: string;
  /** Quiet detail after the label, like "2 of 4". Changing only this does not restart the pill */
  meta?: string;
  /** A file chip after the label, like { name: 'PricingCard.tsx', type: 'tsx' } */
  file?: { name: string; type?: string };
  /** A button at the end, for when the agent needs the person */
  action?: { label: string; onClick: () => void };
  /** 0 to 100, drawn as a track along the bottom of the bar variant */
  progress?: number;
  /** pill hugs its content, bar is taller and leaves room for the progress track */
  variant?: 'pill' | 'bar';
  className?: string;
}

const LIVE: StatusPillState[] = ['thinking', 'reading', 'working'];
const FT: Record<string, string> = { tsx: 'dm-re', jsx: 'dm-re', csv: 'dm-csv', pdf: 'dm-pdf', fig: 'dm-fg' };

function Glyph({ state }: { state: StatusPillState }) {
  if (state === 'thinking') return <span className="dm-g" style={{ color: 'var(--dm-fg)' }}><Think /></span>;
  if (state === 'reading') return <span className="dm-g" style={{ color: 'var(--dm-fg)' }}><Radar /></span>;
  if (state === 'working') return <span className="dm-g" style={{ color: 'var(--dm-fg)' }}><Spin /></span>;
  if (state === 'waiting') return <span className="dm-g" style={{ color: 'var(--dm-warn-mark)' }}><Dot /></span>;
  if (state === 'done') return <span className="dm-g" style={{ color: 'var(--dm-ok-mark)' }}><Icon name="ok" /></span>;
  return <span className="dm-g"><Dot color="var(--dm-faint)" /></span>;
}

/** One live line for what the agent is doing right now. It fades between states and resizes to fit them. */
export function StatusPill(props: StatusPillProps) {
  const { variant = 'pill', progress = 0, className } = props;
  const reduce = useReducedMotion();
  // a new state, label, file or action fades the old line out before the new one comes in;
  // changes to meta, progress or the action's handler show straight away
  const keyOf = (p: StatusPillProps) => [p.state ?? 'idle', p.label, p.file?.name ?? '', p.action?.label ?? ''].join('\u0000');
  const key = keyOf(props);
  const [prev, setPrev] = useState(props);
  const latest = useRef(props);
  useEffect(() => { latest.current = props; });
  const prevKey = keyOf(prev), fading = key !== prevKey;
  const view = fading ? prev : props, state = view.state ?? 'idle';
  useEffect(() => {
    if (!fading) return;
    const t = setTimeout(() => setPrev(latest.current), reduce ? 0 : 180);
    return () => clearTimeout(t);
  }, [key, prevKey, reduce]);

  // switching between pill and bar morphs in three beats, so the words and the shape never move at once: the line fades
  // out with its track, the shape changes while it's empty, then the new layout fades in with the track under it
  const [shape, setShape] = useState(variant);
  const [morphing, setMorphing] = useState(false);
  const shapeRef = useRef(variant);
  useEffect(() => {
    if (variant === shapeRef.current) return;
    if (reduce){ shapeRef.current = variant; setShape(variant); return; }
    setMorphing(true);
    const a = setTimeout(() => { shapeRef.current = variant; setShape(variant); }, 170);
    const b = setTimeout(() => setMorphing(false), 430);
    return () => { clearTimeout(a); clearTimeout(b); };
  }, [variant, reduce]);

  // the pill always hugs its content; the bar keeps a little extra room for its track. Neither is ever wider than the room
  // it has (a phone): its words give way with an ellipsis
  const box = useRef<HTMLDivElement>(null), rootRef = useRef<HTMLDivElement>(null);
  const [width, setWidth] = useState<number>();
  const [room, setRoom] = useState(Infinity);
  useEffect(() => {
    // the room is what its container gives it (the pill itself is only as wide as its words)
    const r = rootRef.current?.parentElement; if (!r || typeof ResizeObserver === 'undefined') return;
    const ro = new ResizeObserver(([e]) => setRoom(Math.round(e.contentRect.width) || Infinity));
    ro.observe(r);
    return () => ro.disconnect();
  }, []);
  useIsoLayoutEffect(() => {
    const el = box.current; if (!el) return;
    const fit = () => { el.style.width = 'max-content'; const w = el.scrollWidth; el.style.width = ''; setWidth(Math.min(shape === 'bar' ? Math.max(w + 24, 300) : w, room)); };
    fit();
    document.fonts?.ready.then(fit);
  }, [prevKey, shape, view.meta, room]);

  return (
    <div ref={rootRef} data-dm="" className={cx('dm-spl', shape === 'bar' && 'dm-bar', morphing && 'dm-mo', className)}>
      <div className="dm-spl-pill" style={{ width: width ?? (shape === 'bar' ? 300 : 'max-content') }} aria-live="polite">
        <div ref={box} className={cx('dm-spl-in', (fading || morphing) && 'dm-out')}>
          <Glyph state={state} />
          <span className={LIVE.includes(state) ? 'dm-shim' : state === 'idle' ? 'dm-fg2' : undefined}>{view.label}</span>
          {view.file && <span className="dm-fchip" style={{ height: 24 }}>{view.file.type && <span className={cx('dm-ft', FT[view.file.type])}>{view.file.type.toUpperCase()}</span>}{view.file.name}</span>}
          {view.meta && <span className="dm-m">{view.meta}</span>}
          {view.action
            ? <button type="button" className="dm-pill dm-primary dm-sm" onClick={() => props.action?.onClick()}>{view.action.label}</button>
            : <span className="dm-end" />}
        </div>
        <div className="dm-spl-track"><div className="dm-spl-fill" style={{ width: Math.max(0, Math.min(100, progress)) + '%' }} /></div>
      </div>
    </div>
  );
}
status-pill.cssReact · 51 lines
/* Generated from designme.dev by scripts/sync.mjs. Edit the site, then sync. */
/* ---------- Status pill ---------- */
.dm-spl-stage{min-height:44px;justify-content:center}
.dm-spl-pill{background:var(--dm-surface);border-radius:var(--dm-r-pill);box-shadow:var(--dm-shadow);height:40px;display:flex;align-items:center;overflow:hidden;transition:width .6s var(--dm-ease),border-radius .5s var(--dm-ease),height .5s var(--dm-ease)}
.dm-spl-in{display:flex;align-items:center;gap:9px;padding:0 6px 0 14px;height:100%;white-space:nowrap;font-size:13.5px;transition:opacity .32s var(--dm-ease),filter .32s var(--dm-ease)}
.dm-spl-in.dm-out{opacity:0;filter:blur(4px);transition-duration:.16s}
/* the mark's box is the mark itself, so the room before it is the pill's own padding, the same as the room after the words
   (owner, 21 Nov: "too much on left vs right visually"): a pale dot no longer sits 5px further in than a spinner */
.dm-spl-in .dm-g{display:grid;place-items:center;min-width:6px;color:var(--dm-fg2)}
.dm-spl-in .dm-m{color:var(--dm-muted);font-variant-numeric:tabular-nums}
.dm-spl-in .dm-end{width:0}
.dm-spl-in>:is(.dm-g,.dm-m,.dm-fchip,.dm-pill){flex:none}
.dm-spl-in>span:not(.dm-g,.dm-m,.dm-end,.dm-fchip){min-width:0;overflow:hidden;text-overflow:ellipsis}
.dm-spl-in .dm-pill{height:28px;margin-left:var(--dm-s-1)}
/* nothing in it grows or shrinks when it is pressed (owner, 18 Nov) */
.dm-spl .dm-pill:active{transform:none}
/* the bar is a small card: its line and the track under it sit 16px in from every edge (owner, 18 Nov). Its line is as tall
   as its words, or as Review while Review is there, so it grows a little round the button and shrinks back after, smoothly,
   and keeps no room for it otherwise */
.dm-spl.dm-bar .dm-spl-pill{--dm-spl-row:18px;border-radius:var(--dm-r-card);height:calc(var(--dm-spl-row) + 45px);align-items:flex-start}
.dm-spl.dm-bar .dm-spl-pill:has(.dm-spl-in .dm-pill){--dm-spl-row:28px}
.dm-spl.dm-bar .dm-spl-in{height:var(--dm-spl-row);margin-top:16px;width:100%;padding:0 var(--dm-s-4);line-height:18px}
.dm-spl.dm-bar .dm-spl-in .dm-m,.dm-spl.dm-bar .dm-spl-in .dm-pill{margin-left:auto}
.dm-spl.dm-bar .dm-spl-in .dm-end{display:none}
.dm-spl-track{position:absolute;left:16px;right:16px;bottom:16px;height:3px;border-radius:var(--dm-r-tiny,2px);background:var(--dm-rail);overflow:hidden;opacity:0;transition:opacity .16s}
.dm-spl.dm-bar .dm-spl-track{opacity:1;transition:opacity .4s var(--dm-ease) .1s}
.dm-spl.dm-mo .dm-spl-track{opacity:0;transition:opacity .16s}
.dm-spl-fill{height:100%;width:0;border-radius:inherit;background:var(--dm-accent-mark,var(--dm-accent));transition:width .8s var(--dm-ease)}
.dm-spl-pill{position:relative}
/* Studio (owner, 17 Nov): a hairline pill, 36px, with the card's outline and short shadow; the marks keep their colours
   (the blue spinner and fill, the green tick, the orange wait dot). A step crosses with a 3px fade, no blur; Review is the
   ink button, round and concentric in the pill. The bar takes the card's round corners, its content 16px in from every edge
   (owner, 18 Nov), a 3px rail with the accent fill, and Review a 28px pill */
:root[data-style="studio"] .dm-spl-stage,:root [data-style="studio"] .dm-spl-stage,:root [data-style="studio"].dm-spl-stage{min-height:40px}
/* its hairline at half the card's (owner, 21 Nov: "reducing opacity on the border by 50% on studio") */
:root[data-style="studio"] .dm-spl-pill,:root [data-style="studio"] .dm-spl-pill,:root [data-style="studio"].dm-spl-pill{height:36px;border-radius:999px;background:var(--dm-surface);box-shadow:0 0 0 1px rgba(0,0,0,.035),0 1px 1px rgba(0,0,0,.04),0 2px 10px -4px rgba(0,0,0,.12);transition:width var(--dm-t) var(--dm-ease),border-radius .42s var(--dm-ease),height .42s var(--dm-ease)}
:root[data-style="studio"][data-theme="dark"] .dm-spl-pill,:root[data-theme="dark"] [data-style="studio"] .dm-spl-pill,:root[data-theme="dark"] [data-style="studio"].dm-spl-pill{box-shadow:0 0 0 1px rgba(255,255,255,.05),0 1px 1px rgba(0,0,0,.5),0 2px 10px -4px rgba(0,0,0,.6)}
@media (prefers-color-scheme:dark){:root[data-style="studio"]:not([data-theme="light"]) .dm-spl-pill,:root:not([data-theme="light"]) [data-style="studio"] .dm-spl-pill,:root:not([data-theme="light"]) [data-style="studio"].dm-spl-pill{box-shadow:0 0 0 1px rgba(255,255,255,.05),0 1px 1px rgba(0,0,0,.5),0 2px 10px -4px rgba(0,0,0,.6)}}
:root[data-style="studio"] .dm-spl-in,:root [data-style="studio"] .dm-spl-in,:root [data-style="studio"].dm-spl-in{gap:8px;padding:0 4px 0 13px;font-size:13px;color:var(--dm-fg);transition:opacity var(--dm-t-fast) var(--dm-ease),transform var(--dm-t-fast) var(--dm-ease)}
:root[data-style="studio"] .dm-spl-in.dm-out,:root [data-style="studio"] .dm-spl-in.dm-out,:root [data-style="studio"].dm-spl-in.dm-out{opacity:0;filter:none;transform:translateY(-3px);transition:opacity .15s ease-in-out,transform .15s ease-in-out}
:root[data-style="studio"] .dm-spl-in .dm-m,:root [data-style="studio"] .dm-spl-in .dm-m,:root [data-style="studio"].dm-spl-in .dm-m{color:var(--dm-muted)}
/* (Review is the site's small button, 28px, 4px in from the pill's edge all round) */
:root[data-style="studio"] .dm-spl-in .dm-pill,:root [data-style="studio"] .dm-spl-in .dm-pill,:root [data-style="studio"].dm-spl-in .dm-pill{height:28px;padding:0 12px;border-radius:999px;margin-left:2px}
:root[data-style="studio"] .dm-spl.dm-bar .dm-spl-pill,:root [data-style="studio"] .dm-spl.dm-bar .dm-spl-pill,:root [data-style="studio"].dm-spl.dm-bar .dm-spl-pill{height:calc(var(--dm-spl-row) + 45px);border-radius:var(--dm-r-card)}
:root[data-style="studio"] .dm-spl.dm-bar .dm-spl-in,:root [data-style="studio"] .dm-spl.dm-bar .dm-spl-in,:root [data-style="studio"].dm-spl.dm-bar .dm-spl-in{height:var(--dm-spl-row);padding:0 16px}
:root[data-style="studio"] .dm-spl.dm-bar .dm-spl-in .dm-pill,:root [data-style="studio"] .dm-spl.dm-bar .dm-spl-in .dm-pill,:root [data-style="studio"].dm-spl.dm-bar .dm-spl-in .dm-pill{height:28px;padding:0 12px;margin-left:auto}
/* the measure under the bar: it lets the pointer through */
:root[data-style="studio"] .dm-spl-track,:root [data-style="studio"] .dm-spl-track,:root [data-style="studio"].dm-spl-track{left:16px;right:16px;bottom:16px;height:3px;border-radius:var(--dm-r-tiny,2px);background:var(--dm-rail);pointer-events:none}
:root[data-style="studio"] .dm-spl-fill,:root [data-style="studio"] .dm-spl-fill,:root [data-style="studio"].dm-spl-fill{background:var(--dm-accent-mark);transition:width .6s var(--dm-ease)}
@media (prefers-reduced-motion:reduce){:root[data-style="studio"] :is(.dm-spl-pill,.dm-spl-in,.dm-spl-in.dm-out,.dm-spl-fill),:root [data-style="studio"] :is(.dm-spl-pill,.dm-spl-in,.dm-spl-in.dm-out,.dm-spl-fill),:root [data-style="studio"]:is(.dm-spl-pill,.dm-spl-in,.dm-spl-in.dm-out,.dm-spl-fill){transition:none!important}}
StatusPill.astroAstro · 29 lines
---
// Generated from designme.dev by scripts/sync.mjs. Edit the site, then sync.
// Status pill: One live line for what the agent is doing right now.
// The markup, CSS and script are designme.dev's own, run by the shared core in ../core, which mounts the component when it scrolls
// into view and plays its demo. To show your own data, change status-pill.js. The markup is kept exactly as it is (is:raw).
import type { HTMLAttributes } from 'astro/types';
import '../core/designme.css';
import './status-pill.css';

export interface Props extends HTMLAttributes<'div'> {
  /** "soft" or "studio" draws it in that style. Leave it out for Blueprint, or for the style set on <html> (data-style="soft" or "studio") */
  'data-style'?: 'soft' | 'studio';
}
const { class: className, ...rest } = Astro.props;
---
<div class:list={['card', className]} data-c="status-pill" {...rest}>
  <div class="stage-in"><Fragment is:raw>
<div class="spl dm">
  <div class="spl-stage dm-main">
    <div class="spl-pill" aria-live="polite"><div class="spl-in"></div></div>
  </div>
  <div class="demo"><div class="seg2" role="group" aria-label="Variant"><button aria-pressed="true" data-v="pill">Pill</button><button aria-pressed="false" data-v="bar">Bar</button></div></div>
</div>
  </Fragment></div>
</div>
<script>
  import './status-pill.js';
</script>
status-pill.htmlHTML · 11 lines
<div class="card" data-c="status-pill">
  <div class="stage-in">
    <div class="spl dm">
      <div class="spl-stage dm-main">
        <div class="spl-pill" aria-live="polite"><div class="spl-in"></div></div>
      </div>
      <div class="demo"><div class="seg2" role="group" aria-label="Variant"><button aria-pressed="true" data-v="pill">Pill</button><button aria-pressed="false" data-v="bar">Bar</button></div></div>
    </div>
  </div>
</div>
status-pill.cssHTML · 50 lines
/* ---------- Status pill ---------- */
.spl-stage{min-height:44px;justify-content:center}
.spl-pill{background:var(--dm-surface);border-radius:var(--dm-r-pill);box-shadow:var(--dm-shadow);height:40px;display:flex;align-items:center;overflow:hidden;transition:width .6s var(--dm-ease),border-radius .5s var(--dm-ease),height .5s var(--dm-ease)}
.spl-in{display:flex;align-items:center;gap:9px;padding:0 6px 0 14px;height:100%;white-space:nowrap;font-size:13.5px;transition:opacity .32s var(--dm-ease),filter .32s var(--dm-ease)}
.spl-in.out{opacity:0;filter:blur(4px);transition-duration:.16s}
/* the mark's box is the mark itself, so the room before it is the pill's own padding, the same as the room after the words
   (owner, 21 Nov: "too much on left vs right visually"): a pale dot no longer sits 5px further in than a spinner */
.spl-in .g{display:grid;place-items:center;min-width:6px;color:var(--dm-fg2)}
.spl-in .m{color:var(--dm-muted);font-variant-numeric:tabular-nums}
.spl-in .end{width:0}
.spl-in>:is(.g,.m,.fchip,.pill){flex:none}
.spl-in>span:not(.g,.m,.end,.fchip){min-width:0;overflow:hidden;text-overflow:ellipsis}
.spl-in .pill{height:28px;margin-left:var(--dm-s-1)}
/* nothing in it grows or shrinks when it is pressed (owner, 18 Nov) */
.spl .pill:active{transform:none}
/* the bar is a small card: its line and the track under it sit 16px in from every edge (owner, 18 Nov). Its line is as tall
   as its words, or as Review while Review is there, so it grows a little round the button and shrinks back after, smoothly,
   and keeps no room for it otherwise */
.spl.bar .spl-pill{--dm-spl-row:18px;border-radius:var(--dm-r-card);height:calc(var(--dm-spl-row) + 45px);align-items:flex-start}
.spl.bar .spl-pill:has(.spl-in .pill){--dm-spl-row:28px}
.spl.bar .spl-in{height:var(--dm-spl-row);margin-top:16px;width:100%;padding:0 var(--dm-s-4);line-height:18px}
.spl.bar .spl-in .m,.spl.bar .spl-in .pill{margin-left:auto}
.spl.bar .spl-in .end{display:none}
.spl-track{position:absolute;left:16px;right:16px;bottom:16px;height:3px;border-radius:var(--dm-r-tiny,2px);background:var(--dm-rail);overflow:hidden;opacity:0;transition:opacity .16s}
.spl.bar .spl-track{opacity:1;transition:opacity .4s var(--dm-ease) .1s}
.spl.mo .spl-track{opacity:0;transition:opacity .16s}
.spl-fill{height:100%;width:0;border-radius:inherit;background:var(--dm-accent-mark,var(--dm-accent));transition:width .8s var(--dm-ease)}
.spl-pill{position:relative}
/* Studio (owner, 17 Nov): a hairline pill, 36px, with the card's outline and short shadow; the marks keep their colours
   (the blue spinner and fill, the green tick, the orange wait dot). A step crosses with a 3px fade, no blur; Review is the
   ink button, round and concentric in the pill. The bar takes the card's round corners, its content 16px in from every edge
   (owner, 18 Nov), a 3px rail with the accent fill, and Review a 28px pill */
:root[data-style="studio"] .spl-stage,:root [data-style="studio"] .spl-stage,:root [data-style="studio"].spl-stage{min-height:40px}
/* its hairline at half the card's (owner, 21 Nov: "reducing opacity on the border by 50% on studio") */
:root[data-style="studio"] .spl-pill,:root [data-style="studio"] .spl-pill,:root [data-style="studio"].spl-pill{height:36px;border-radius:999px;background:var(--dm-surface);box-shadow:0 0 0 1px rgba(0,0,0,.035),0 1px 1px rgba(0,0,0,.04),0 2px 10px -4px rgba(0,0,0,.12);transition:width var(--dm-t) var(--dm-ease),border-radius .42s var(--dm-ease),height .42s var(--dm-ease)}
:root[data-style="studio"][data-theme="dark"] .spl-pill,:root[data-theme="dark"] [data-style="studio"] .spl-pill,:root[data-theme="dark"] [data-style="studio"].spl-pill{box-shadow:0 0 0 1px rgba(255,255,255,.05),0 1px 1px rgba(0,0,0,.5),0 2px 10px -4px rgba(0,0,0,.6)}
@media (prefers-color-scheme:dark){:root[data-style="studio"]:not([data-theme="light"]) .spl-pill,:root:not([data-theme="light"]) [data-style="studio"] .spl-pill,:root:not([data-theme="light"]) [data-style="studio"].spl-pill{box-shadow:0 0 0 1px rgba(255,255,255,.05),0 1px 1px rgba(0,0,0,.5),0 2px 10px -4px rgba(0,0,0,.6)}}
:root[data-style="studio"] .spl-in,:root [data-style="studio"] .spl-in,:root [data-style="studio"].spl-in{gap:8px;padding:0 4px 0 13px;font-size:13px;color:var(--dm-fg);transition:opacity var(--dm-t-fast) var(--dm-ease),transform var(--dm-t-fast) var(--dm-ease)}
:root[data-style="studio"] .spl-in.out,:root [data-style="studio"] .spl-in.out,:root [data-style="studio"].spl-in.out{opacity:0;filter:none;transform:translateY(-3px);transition:opacity .15s ease-in-out,transform .15s ease-in-out}
:root[data-style="studio"] .spl-in .m,:root [data-style="studio"] .spl-in .m,:root [data-style="studio"].spl-in .m{color:var(--dm-muted)}
/* (Review is the site's small button, 28px, 4px in from the pill's edge all round) */
:root[data-style="studio"] .spl-in .pill,:root [data-style="studio"] .spl-in .pill,:root [data-style="studio"].spl-in .pill{height:28px;padding:0 12px;border-radius:999px;margin-left:2px}
:root[data-style="studio"] .spl.bar .spl-pill,:root [data-style="studio"] .spl.bar .spl-pill,:root [data-style="studio"].spl.bar .spl-pill{height:calc(var(--dm-spl-row) + 45px);border-radius:var(--dm-r-card)}
:root[data-style="studio"] .spl.bar .spl-in,:root [data-style="studio"] .spl.bar .spl-in,:root [data-style="studio"].spl.bar .spl-in{height:var(--dm-spl-row);padding:0 16px}
:root[data-style="studio"] .spl.bar .spl-in .pill,:root [data-style="studio"] .spl.bar .spl-in .pill,:root [data-style="studio"].spl.bar .spl-in .pill{height:28px;padding:0 12px;margin-left:auto}
/* the measure under the bar: it lets the pointer through */
:root[data-style="studio"] .spl-track,:root [data-style="studio"] .spl-track,:root [data-style="studio"].spl-track{left:16px;right:16px;bottom:16px;height:3px;border-radius:var(--dm-r-tiny,2px);background:var(--dm-rail);pointer-events:none}
:root[data-style="studio"] .spl-fill,:root [data-style="studio"] .spl-fill,:root [data-style="studio"].spl-fill{background:var(--dm-accent-mark);transition:width .6s var(--dm-ease)}
@media (prefers-reduced-motion:reduce){:root[data-style="studio"] :is(.spl-pill,.spl-in,.spl-in.out,.spl-fill),:root [data-style="studio"] :is(.spl-pill,.spl-in,.spl-in.out,.spl-fill),:root [data-style="studio"]:is(.spl-pill,.spl-in,.spl-in.out,.spl-fill){transition:none!important}}
status-pill.jsHTML · 51 lines
DM.def('status-pill', (r, c) => {
  const pill = $('.spl-pill', r), box = $('.spl-in', r), root = $('.spl', r);
  pill.insertAdjacentHTML('beforeend', '<div class="spl-track"><div class="spl-fill"></div></div>');
  const fill = $('.spl-fill', r);
  // the switch morphs in three beats, so the words and the shape never move at once: the line fades out with its track,
  // the pill changes shape while it's empty, then the new layout fades in with the track under it
  let morph = 0;
  seg($('.seg2', r), v => {
    const bar = v === 'bar', id = ++morph; if (root.classList.contains('bar') === bar) return;
    pill.style.width = pill.offsetWidth + 'px'; box.classList.add('out'); root.classList.add('mo');
    c.later(REDUCE ? 0 : 170, () => { if (id !== morph) return; root.classList.toggle('bar', bar); fit(); });
    c.later(REDUCE ? 0 : 430, () => { if (id !== morph) return; morph = 0; box.classList.remove('out'); root.classList.remove('mo'); });
  });
  /* both variants hug their content; the bar keeps a little extra room for its track. Neither is ever wider than the room
     it has (a phone): its words give way with an ellipsis */
  function fit(){
    box.style.width = 'max-content'; const w = box.scrollWidth; box.style.width = '';
    pill.style.width = Math.min(root.classList.contains('bar') ? Math.max(w + 24, 300) : w, pill.parentElement.clientWidth || Infinity) + 'px';
  }
  function set(htmlStr, pct){
    pill.style.width = pill.offsetWidth + 'px';
    box.classList.add('out');
    // mid-switch, the morph brings the line back once the shape has settled
    c.later(180, () => { box.innerHTML = htmlStr; if (!morph) box.classList.remove('out'); fit(); });
    if (pct !== undefined) fill.style.width = pct + '%';
  }
  const think = '<span class="think on"><i></i><i></i><i></i><i></i></span>';
  box.innerHTML = '<span class="g"><span class="dot" style="color:var(--dm-faint)"></span></span><span class="fg2">Ready for a task</span><span class="end"></span>';
  requestAnimationFrame(fit);
  // and it fits again when its room changes
  if (window.ResizeObserver){ let rw = 0; const ro = new ResizeObserver(([e]) => { const w = Math.round(e.contentRect.width); if (w !== rw){ rw = w; fit(); } }); ro.observe(pill.parentElement); c.offs.push(() => ro.disconnect()); }
  const idle = '<span class="g"><span class="dot" style="color:var(--dm-faint)"></span></span><span class="fg2">Ready for a task</span><span class="end"></span>';
  c.run(async () => { for (;;){
    await c.wait(1100);
    set(`<span class="g" style="color:var(--dm-fg)">${think}</span><span class="shim">Thinking</span><span class="end"></span>`, 8); await c.wait(1800);
    set(`<span class="g" style="color:var(--dm-fg)"><span class="radar"></span></span><span class="shim">Reading Figma frames</span><span class="m n">1 of 4</span><span class="end"></span>`, 22);
    await c.wait(400);
    // the count ticks over in place, under a steady line
    for (let i = 2; i <= 4; i++){ await c.wait(650); const n = $('.n', box); if (n) n.textContent = i + ' of 4'; fill.style.width = (22 + i * 8) + '%'; }
    await c.wait(700);
    set(`<span class="g" style="color:var(--dm-fg)"><span class="spin"></span></span><span class="shim">Editing</span><span class="fchip" style="height:24px"><span class="ft re">TSX</span>PricingCard.tsx</span><span class="end"></span>`, 64); await c.wait(2000);
    set(`<span class="g" style="color:var(--dm-warn-mark)"><span class="dot"></span></span><span>Waiting for your approval</span><button class="pill primary sm">Review</button>`, 72);
    /* waits for Review, and carries on by itself after a while so the loop never stalls; once you have taken over, it waits for you */
    await new Promise(res => { c.later(220, () => { const b = $('.pill', box); if (b) b.onclick = res; }); c.auto(8000, res); });
    set(`<span class="g" style="color:var(--dm-fg)"><span class="spin"></span></span><span class="shim">Applying 4 changes</span><span class="end"></span>`, 88); await c.wait(1600);
    // done is a neutral line with the green tick (the mark green), and no elapsed time (owner, 18 Nov)
    set(`<span class="g" style="color:var(--dm-ok-mark)">${I('ok')}</span><span>Done</span><span class="m">4 files changed</span><span class="end"></span>`, 100);
    await c.wait(3200); set(idle, 0);
  } });
});
06

Questions

What people ask about it.

How do I update a counter like "2 of 4" without the pill flashing?
Put the count in meta and keep state and label the same. Only changes to state, label, file or the action label trigger the fade.
Can the agent wait for approval before it continues?
Yes. Set state="waiting" with an action such as { label: 'Review', onClick }, and resume the agent from that handler. The demo does exactly this.
Why doesn't my progress show up?
The progress track belongs to the bar variant. Pass variant="bar" together with progress from 0 to 100; values outside that range are clamped.
07

More in Agent status

Show what the agent is doing, how far along it is, and what it is working with.

ThinkingThe live trace, written as the agent works, then folded away.
Reasoning trailThe agent's plan, notes, sources and edits, after it thinks.
Parallel agentsSeveral agents working in parallel, each with its own lane and hand-offs.
Delegation treeAn orchestrator and its sub-agents, with cost rolled up per branch.
Approval queueEvery run that needs you, is running or is done, in one list.
Trace viewOne agent run as a waterfall of spans, with latency and tokens.
Web searchThe agent's searches as a trail: what it asked, what came back, what it read or skipped, and the answer with its sources.
Agent run timelineEvery model and tool step of a run on one time axis.
All 15 in Agent status →