本文へ移動
日本語
「ライブステータスピル」は Pro に含まれます。解除するとプレビューが表示されます。

仕組み

A fully round pill for something live: an assistant speaking or listening, a recording, reading aloud. The left side holds the title, the context, the level bars and the state; the right side is a canvas of three folds of light, the back ones softer and slower, the front one bright. The light fades into the text side without an edge. Press the pill to pause or resume. The component accepts a real level or supplies its own gentle rhythm.

向いている場面

  • Show voice replies, recordings, streams or other ongoing tasks that can be paused.

使い方

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

<LivePill
  title="Speaking"
  subtitle="Voice reply"
  tone="ink"
  playing={isSpeaking}
  level={audioLevel}
  onToggle={setIsSpeaking}
/>

プロパティ

プロパティ型既定値説明
titlestring'Live activity'The activity name, shown on the first line and included in the accessible name.
subtitlestring'Voice session'Context on the second line, before the level bars and the state. Pass an empty string to show only the bars and the state.
tone'ink' | 'accent' | 'chart-1' | 'chart-2' | 'chart-3' | 'chart-4' | 'chart-5' | 'chart-6' | 'chart-7' | 'chart-8''ink'Ink is a dark pill whose light splits into prism colours from the chart tokens; it stays dark in the dark theme. Accent and chart tones draw pastel folds of that one colour on the normal surface, and glowing ones on a dark surface.
size'sm' | 'md''md'64px or 44px tall. The native button inside is 44px tall and the whole pill is its hit area.
playingboolean—Controlled activity state. Update it when the activity actually pauses or resumes.
defaultPlayingbooleantrueInitial state when playing is omitted.
onToggle(next: boolean) => void—Receives the requested playing state when the button is activated.
levelnumber—A normalized input from 0 to 1 sets the height of the bars and the thickness of the light. Omit for a gentle automatic pulse.
labels{ live?: string; paused?: string; name?: (data: LabelData) => string; announce?: (data: LabelData) => string }—Replace state text, the accessible name and pause/resume announcements. LabelData contains title, subtitle, status and playing.
motionPausedbooleanfalseHold the decorative motion on its current frame while preserving the activity state.

アクセシビリティ

  • Tab focuses the native button, and the focus ring wraps the whole pill. Enter, Space, a click or a tap anywhere on the pill activates it.
  • The accessible name includes the state. The change is announced politely, and the state is written next to the level bars, not shown by colour alone.

モーション

The light and the bars share one animation loop for every pill on the page. A paused activity coasts to a stop over 900ms while the light dims and the bars settle; a resumed one gathers speed over 360ms. A press squashes the pill slightly and it springs back. Offscreen pills and hidden tabs stop drawing. Reduced motion keeps the light and the bars still and removes the squash.

プロジェクトに追加

Pro メンバーはプロンプトをコピーし、コーディングエージェントが無料コンポーネントと同じ手順でソースを導入します。

LivePill.jsxlive-pill.csstokens.cssREADME.md

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

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