本文へ移動
日本語

仕組み

The pill sizes itself to its content and turns every change into motion instead of a cut. The fill is wider than the pill and clipped from the right by --ds-agent-w, a registered length (@property) set to the measured content width, so it can transition: the visible pill grows and shrinks over 520ms while the layout box changes at once. The elapsed time is measured before paint and eased back from where it was (FLIP), so it rides along with the end. The old label leaves upward into a 4px blur and the new one rises out of one. While running, a sheen sweeps across the label (background-clip: text) and a blurred conic gradient of the chart colours turns slowly behind the trailing end. Before the first measurement nothing is clipped, so the server render shows the whole pill.

向いている場面

  • An assistant or agent working on a request: show which step it is on and for how long.
  • Background jobs the person is waiting for: an import, an export, a sync, a build.
  • Anywhere one line of live status is better than a full progress list.

向かない場面

  • Known, measurable progress (percent, bytes): use a progress ring or the step loader.
  • Very short waits under a second: a spinner in the button is enough.
  • Tight rows where the width change would push neighbours: give it its own line.

使い方

import { AgentStatus } from './AgentStatus.jsx'

// status: 'running' | 'waiting' | 'done' | 'error'. Pass the current step as label.
export function ImportStatus({ job }) {
  return (
    <AgentStatus
      status={job.state}
      label={job.state === 'done' ? `Imported ${job.count} transactions` : job.step}
      // Omit elapsed to let the pill count from when it mounted
      elapsed={job.seconds}
    />
  )
}

プロパティ

プロパティ型既定値説明
status'running' | 'waiting' | 'done' | 'error''running'Running pulses the orb, sweeps a sheen across the label and shows the glow; waiting uses an amber dot and a slower glow; done and error draw a check or a cross on a disc and let the glow go out.
labelstring—The current step, for example “Comparing 46 hotels”. A new value swaps in with the blur motion. Defaults to labels.status[status].
elapsednumber—Seconds elapsed, when the page owns the clock. Omit it and the pill counts by itself while running or waiting.
runKeystring | number—Restarts the pill's own clock when it changes (a new job). Not needed with elapsed.
formatTime(seconds) => stringformatElapsedFormats the time: “45s”, “1m 05s”, “1h 02m” by default. The helper is exported too.
showTimebooleantrueShows the elapsed time at the end of the pill.
glowbooleantrueThe iridescent glow behind the trailing end while running or waiting.
size'sm' | 'md''md'Pill height: 32 or 40px.
labels{ status: { running, waiting, done, error } }—Replaces the built-in fallback labels used when label is not given.
...restHTMLAttributes—Other attributes go to the root <div>.

アクセシビリティ

  • The label is read through a polite live region (role="status"); the ticking time is hidden from screen readers so it is not announced every second.
  • Status is never colour alone: done and error draw a check or a cross, waiting has its own label.
  • The sheen keeps the label's contrast: it sweeps between the secondary and the primary text colour.
  • Reduced motion swaps labels with a plain fade, jumps the width and the time, and stops the sheen, pulse and swirl; the glow stays still and fainter.

モーション

Label: leave 240ms ease-in to 7px up and 4px blur; enter 420ms ease-out from 7px below after 70ms. Width and time: 520ms cubic-bezier(0.16, 1, 0.3, 1). Sheen: 2.2s linear loop. Glow: a 3.6s turn and a 2.8s drift. Done: the disc pops with a spring in 360ms and the check draws after 120ms.

プロジェクトに追加

プロンプトを Codex または Claude Code に貼り付けます。エージェントが公開ソースを読み、書き込む内容を示したうえで、既存のコンポーネントの隣に追加します。

AgentStatus.jsxagent-status.csstokens.cssREADME.md

2 つのファイルを一緒に導入します。スタイルは tokens.css の変数を読み、予備の値も持つため、単体でも表示できます。

読み込み
「画像リビール」は Pro に含まれます。解除するとプレビューが表示されます。
「オービットローダー」は Pro に含まれます。解除するとプレビューが表示されます。
「パーティクルオーブ」は Pro に含まれます。解除するとプレビューが表示されます。