The clock pill: live, paused or reconnecting, the clock in the viewer's zone running between updates, speed 1x/60x/600x and play or pause, and Replay with its own speeds, playhead and Back to live. Props-driven; optional provider for a shell that owns time.
$ npx shadcn@latest add @highcommand/time-controlCopies the source into your project and pulls in what it needs (4 other items). First time? Add the registry to components.json.
Time: one compact pill with the state, the clock in the viewer's zone, and (where the clock may be run) the speed and Play or Pause; then Replay, which plays the shift back (it changes nothing).
nowrequiredstring | null—the clock's time at its last update (ISO); null before the first
speedrequirednumber—simulated seconds per real second
pausedrequiredboolean—True while the clock is paused; the pill shows Play, and the live badge reads Paused.
streamStreamState'live'the event stream's connection, for the Live badge
speedsreadonly number[]SPEEDSSpeeds offered, in simulated seconds per real second (default 1, 60 and 600).
onSpeed(x: number) => void—Fires with the chosen speed; without it (or onPlayPause) the pill is read-only.
onPlayPause() => void—Fires when Play or Pause is pressed; without it (or onSpeed) the pill is read-only.
lockedstring | nullnullwhy this viewer may not run the clock ("Admin role required"): the pill shows state and time only, the reason in its tooltip
warmingbooleanfalsestill replaying history on start-up
errorstring | nullnullthe last control failed: its reason, in place of the badge
busybooleanfalsea control request is in flight
sourcestring—where the events come from, for the badge's tooltip
replayReplayDrive | null—The replay's state and actions; adds the Replay button and takes over the pill while it plays. Null or absent: no replay.
<LiveBadge />4 propsLive state of the event stream and the clock; sits with the clock, whose controls show the speed.streamrequiredStreamState—The event stream's connection: live, reconnecting or offline.
pausedrequiredboolean—the clock is paused (a replay, a held simulation)
sourcestring—where the events come from, added to the tooltip ("fixture data")
classNamestring—Extra class names for the badge.
<ReplayProvider />1 propsContext for an app shell that owns time: holds the replay a page publishes so the top bar can draw it.childrenrequiredReactNode—The shell the replay context wraps.
localClock(iso: string): string"09:12:23 CDT": the simulated time in the viewer's zone, to the second.
localDate(iso: string): string"Oct 1": the simulated date in the viewer's zone.
useReplayAt(view: ReplayView | null): number | nullThe replayed moment, read from the live actions four times a second while the replay plays (the published one otherwise).
usePublishReplay(ctl: ReviewControl | null, warming: boolean, running: boolean): voidThe command center's side: its replay control (null while there is nothing to replay), whether its data is still warming, and whether the simulator runs.
useReplayView(): ViewThe published replay view (state, warming, whether the simulator runs); idle values without a ReplayProvider.
useReplayActions(): MutableRefObject<ReviewControl | null>A ref to the page's live replay control, null while nothing is published to replay.
Install this free piece now; the Pro pieces drop in on top of it, in the same app. Pro is $79 once.