本文へ移動
日本語

仕組み

All four glyphs live in one slot and cross-fade with a slight spring, so the indicator never shifts. Text changes slide vertically inside a box whose width is measured and eased, and the tone colour mixes the surface, border and icon from one value.

向いている場面

  • Editors and forms that save automatically.
  • Apps that keep working offline and sync later.

向かない場面

  • Forms with an explicit Save button: show feedback on that button.
  • Errors that block work: use a callout.

使い方

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

export function EditorHeader({ status, savedAt, retry }) {
  // status: 'idle' | 'saving' | 'saved' | 'offline' | 'error'
  return <SaveStatus status={status} savedAt={savedAt} onRetry={retry} />
}

プロパティ

プロパティ型既定値説明
status'idle' | 'saving' | 'saved' | 'offline' | 'error''idle'The current state; saved relaxes into idle after settle ms.
savedAtstring—Appended to the idle label, such as “2 min ago”.
onRetry() => void—Shows a Retry button in the error state.
labelsobject—Replaces idle, saving, saved, offline, error and retry text.
variant'pill' | 'inline''pill'Tinted pill, or plain icon and text.
settlenumber2400Ms before Saved becomes the quiet idle label; 0 keeps it.

アクセシビリティ

  • The icon and label sit in a polite role status region, so each new state is announced once; the outgoing label is aria-hidden.
  • Each state has its own icon shape and text, not colour alone.
  • Retry is a real button, 32px high, with a focus ring.
  • With reduced motion labels fade instead of sliding, the width snaps and the arc turns slowly.

モーション

Label slides 320ms ease-out (old one 220ms); width 320ms; icons cross-fade with a 320ms spring; check stroke draws in 360ms; arc turns every 900ms.

プロジェクトに追加

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

SaveStatus.jsxsave-status.csstokens.cssREADME.md

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

フィードバック
「紙吹雪」は Pro に含まれます。解除するとプレビューが表示されます。