# Live activity bar (Notchset): prompt.md (v2.0.0)

- id: `live-activity-bar` · version 2.0.0 · block · free
- category: Marketing
- build: one set of files for every shadcn style
- install: `npx shadcn@latest add https://notchset.dev/r/live-activity-bar.json`
- npm dependencies: lucide-react@^1
- registry dependencies: utils, https://notchset.dev/r/notchset-foundation.json, @notchset/button, @notchset/reveal
- docs: https://notchset.dev/blocks/live-activity-bar
- The install command carries everything this item needs (files, CSS, tokens, npm and registry dependencies). Prefer it to copying source by hand.

The next thing on your day, held above a phone's tab bar: it counts down live, turns into Now with one calm pulse, opens into a small card when pressed and folds away when dismissed. Nothing moves at rest..

## Build it
- Stack: React 18.3 or 19, TypeScript, Tailwind CSS v4 utility classes on the foundation's roles, a components.json (imports use its aliases).
- Packages: `lucide-react@^1`.
- Files: `components/ui/notchset/blocks/live-activity-bar.tsx`.
- Registry dependencies, installed with it automatically: shadcn `utils` (cn), `notchset-foundation`, `button`, `reveal`.
- Builds: one set of files, the same for every shadcn style.
- Exports to keep: `LiveActivityBar`, and every exported type.
- CSS: the install adds the notchset foundation (its roles, keyframes and motion switch, reading your shadcn tokens for colour) to your global stylesheet once. Nothing to import by hand.
- Re-running `add` (or `--overwrite`) re-applies those rules: put overrides in your own CSS, never in the installed rules.
- Colours: every part reads the foundation's roles (`--ns-canvas`, `--ns-ink`, `--ns-line`, `--ns-signal` …), which read your shadcn tokens (`--background`, `--foreground`, `--border`, `--destructive` …), plus the optional `--success` and `--warning`. Retheme on `:root` or any container; never add Tailwind colour classes inside the component.
- This item reads `--ns-canvas`, `--ns-ease`, `--ns-ink`, `--ns-ok`, `--ns-radius-lg`, `--ns-shadow-float`, `--ns-text-small`, `--ns-time-color`, `--ns-time-menu`, `--ns-time-toast`, `--ns-weight-medium`.
- Retune it (on any ancestor) with the foundation's roles and hooks: `--ns-bad`, `--ns-bad-ink`, `--ns-band`, `--ns-band-edge`, `--ns-band-grade`, `--ns-band-optimal`, `--ns-beat`, `--ns-bezel`, `--ns-canvas`, `--ns-cat-1`, `--ns-cat-2`, `--ns-cat-3`, `--ns-cat-4`, `--ns-cat-5`, `--ns-cat-6`, `--ns-check`, `--ns-chip`, `--ns-control`, `--ns-control-pad`, `--ns-control-sm`, `--ns-deep`, `--ns-deep-ink`, `--ns-deep-ink-2`, `--ns-deep-line`, `--ns-dialog`, `--ns-dialog-lg`, `--ns-dialog-sm`, `--ns-ease`, `--ns-ease-in`, `--ns-ease-panel`, `--ns-ease-pop`, `--ns-field`, `--ns-flood-arc`, `--ns-flood-aurora`, `--ns-flood-behind-1`, `--ns-flood-behind-2`, `--ns-flood-bloom`, `--ns-flood-deep`, `--ns-flood-dial-bloom`, `--ns-flood-glass`, `--ns-flood-grain`, `--ns-flood-image`, `--ns-flood-ink`, `--ns-flood-ink-low`, `--ns-flood-light`, `--ns-flood-mid`, `--ns-flood-pale`, `--ns-flood-pane`, `--ns-flood-pane-edge`, `--ns-flood-pill-ink`, `--ns-flood-ribbon`, `--ns-flood-ribbon-core`, `--ns-flood-shadow`, `--ns-flood-sheen`, `--ns-flood-wash`, `--ns-font-body`, `--ns-font-display`, `--ns-font-mono`, `--ns-font-script`, `--ns-glass`, `--ns-glass-blur`, `--ns-glass-shadow`, `--ns-glow`, `--ns-grain`, `--ns-gutter`, `--ns-header`, `--ns-heat`, `--ns-hover`, `--ns-ink`, `--ns-ink-2`, `--ns-ink-3`, `--ns-ink-4`, `--ns-leading`, `--ns-lift`, `--ns-light-1`, `--ns-light-2`, `--ns-light-3`, `--ns-light-spread`, `--ns-light-strength`, `--ns-line`, `--ns-line-soft`, `--ns-lit-edge`, `--ns-menu-dy`, `--ns-menu-row`, `--ns-mesh`, `--ns-mesh-frost`, `--ns-ok`, `--ns-ok-ink`, `--ns-orb-body`, `--ns-orb-cool`, `--ns-orb-core`, `--ns-orb-dawn`, `--ns-orb-deep`, `--ns-orb-edge`, `--ns-orb-grain`, `--ns-orb-ground`, `--ns-orb-halo`, `--ns-orb-inner`, `--ns-orb-key`, `--ns-orb-lift`, `--ns-orb-limb`, `--ns-orb-limb-from`, `--ns-orb-rim`, `--ns-orb-skin-hi`, `--ns-orb-skin-lo`, `--ns-orb-skin-mid`, `--ns-orb-warm`, `--ns-panel`, `--ns-panel-w`, `--ns-prism-edge`, `--ns-prism-glint`, `--ns-prism-sheen`, `--ns-prism-tint`, `--ns-pulse`, `--ns-radius`, `--ns-radius-card`, `--ns-radius-full`, `--ns-radius-lg`, `--ns-radius-sm`, `--ns-radius-xl`, `--ns-raised`, `--ns-range`, `--ns-row`, `--ns-row-compact`, `--ns-segment`, `--ns-selected`, `--ns-series`, `--ns-series-core`, `--ns-series-lilac`, `--ns-series-tint`, `--ns-shadow-dialog`, `--ns-shadow-float`, `--ns-shadow-panel`, `--ns-sheet`, `--ns-sheet-bottom`, `--ns-side`, `--ns-signal`, `--ns-sleep-awake`, `--ns-sleep-deep`, `--ns-sleep-light`, `--ns-sleep-rem`, `--ns-space-1`, `--ns-space-2`, `--ns-space-3`, `--ns-space-4`, `--ns-space-5`, `--ns-space-6`, `--ns-space-8`, `--ns-space-section`, `--ns-stack-on`, `--ns-standing-critical`, `--ns-standing-in`, `--ns-standing-out`, `--ns-state-doing`, `--ns-state-done`, `--ns-state-review`, `--ns-state-todo`, `--ns-switch-h`, `--ns-switch-w`, `--ns-text-body`, `--ns-text-control`, `--ns-text-display`, `--ns-text-figure`, `--ns-text-headline`, `--ns-text-hero`, `--ns-text-lede`, `--ns-text-meta`, `--ns-text-page`, `--ns-text-record`, `--ns-text-small`, `--ns-text-strong`, `--ns-text-sub`, `--ns-text-title`, `--ns-tile-shadow`, `--ns-time-born`, `--ns-time-color`, `--ns-time-dialog`, `--ns-time-menu`, `--ns-time-page`, `--ns-time-panel`, `--ns-time-toast`, `--ns-tint`, `--ns-tint-ink`, `--ns-toast-bottom`, `--ns-toast-left`, `--ns-touch`, `--ns-tracking-display`, `--ns-tracking-headline`, `--ns-warn`, `--ns-warn-ink`, `--ns-wash-clay`, `--ns-wash-dusk`, `--ns-wash-graphite`, `--ns-wash-ink`, `--ns-wash-sage`, `--ns-wash-sand`, `--ns-weight-light`, `--ns-weight-medium`, `--ns-weight-regular`, `--ns-weight-strong`, `--ns-well`.
- Never add Tailwind colour classes inside the component.

```tsx
import { LiveActivityBar } from "@/components/ui/notchset/blocks/live-activity-bar";
```

## Parts
- A single export that takes props.

## Match the original
- Read `components/ui/notchset/blocks/live-activity-bar.tsx` as the reference implementation before changing or recreating anything, and match it: sizes, colours per theme, motion timings, copy and behaviour.
- If you deviate (a prop you can't honour, a style you changed, a dependency you swapped), say so in your reply, part by part.
- Keep the accessibility contract, the keyboard map and the motion levels listed below.

## Use it when

### Not when

## Built from
- button (`button`), installed with it: reuse it, don't rebuild it
- reveal (`reveal`), installed with it: reuse it, don't rebuild it

## Mistakes
- Recreating the component instead of installing it

## Usage

```tsx
"use client";
import * as React from "react";
import { LiveActivityBar } from "@/components/ui/notchset/blocks/live-activity-bar";
import { Button } from "@/components/ui/notchset/button";

export default function LiveActivityBarDemo() {
  const [start, setStart] = React.useState(() => Date.now() + 8 * 60e3);
  const [shown, setShown] = React.useState(true);
  return (
    <div className="flex w-full max-w-[390px] flex-col gap-3">
      <div className="flex h-[200px] flex-col justify-end rounded-[var(--ns-radius-xl)] bg-[var(--ns-canvas)] px-3 pb-3 shadow-[inset_0_0_0_1px_var(--ns-line)]">
        {shown && <LiveActivityBar key={start} title="Discovery call" subtitle="Airtable" startsAt={start} where="Video call" people="Priya, Sam Okafor" onJoin={() => {}} onDismiss={() => setShown(false)} />}
      </div>
      <div className="flex gap-2">
        <Button size="sm" onClick={() => (setStart(Date.now() + 8 * 60e3), setShown(true))}>
          In 8 minutes
        </Button>
        <Button size="sm" onClick={() => (setStart(Date.now() + 12e3), setShown(true))}>
          The last seconds
        </Button>
      </div>
    </div>
  );
}
```

## Props

| Prop | Type | Default | What it does |
|---|---|---|---|
| `title` | `string` |  | Required. |
| `subtitle` | `string` |  |  |
| `startsAt` | `string \| number \| Date` |  | Required. |
| `now` | `number` |  | the current time in ms, for a controlled clock; omit to let the bar tick by itself |
| `where` | `string` |  | where it happens ("Google Meet", "Room 4") |
| `people` | `React.ReactNode` |  | who is in it, in words |
| `joinLabel` | `string` | `"Join"` |  |
| `onJoin` | `() => void` |  |  |
| `onDismiss` | `() => void` |  |  |

Full docs: https://notchset.dev/blocks/live-activity-bar

## Customising
- Colours: every part reads the foundation's roles (`--ns-canvas`, `--ns-ink`, `--ns-line`, `--ns-signal` …), which read your shadcn tokens (`--background`, `--foreground`, `--border`, `--destructive` …), plus the optional `--success` and `--warning`. Retheme on `:root` or any container; never add Tailwind colour classes inside the component.
- Dark mode follows the `.dark` class or `data-theme="dark"` on an ancestor (the shadcn and next-themes conventions).
- Update later: Commit or stash local changes first (or copy the files), so the update can be undone. Read https://notchset.dev/r/changelog.json for the new versions: a major version, an entry marked breaking or a merge says what to change. Then re-run the install with `--overwrite`, on a branch. It replaces the component's files, the shared helper files they import, and the item's CSS rules in the global stylesheet, so review the whole diff (components, shared files, CSS), re-apply your own edits, and run the app's typecheck, tests and build.

## Accessibility contract (preserve when editing)

## Install

```bash
npx shadcn@latest add https://notchset.dev/r/live-activity-bar.json
```

Or add the `@notchset` registry to components.json and run `npx shadcn@latest add @notchset/live-activity-bar`. Every components.json style gets the same files.

## Source

### components/ui/notchset/blocks/live-activity-bar.tsx

```tsx
// Notchset live-activity-bar 2.0.0 · https://notchset.dev/changelog
"use client";
import * as React from "react";
import { ChevronUp, X } from "lucide-react";
import { cn } from "@/lib/utils";
import { Button } from "@/components/ui/notchset/button";
import { Reveal } from "@/components/ui/notchset/reveal";

/*
 * Live activity bar: the next thing on your day, held at the bottom of the screen just above a tab bar. It rises
 * once when it arrives, counts down live ("in 8 min", then seconds in the last minute), and at the start turns
 * into "Now" with one calm pulse. Press it to open a small card (who, where, Join); dismiss it and it folds away.
 * Nothing laps at rest: the only motion is the arrival, the minute changing and the one pulse at the start.
 *
 *   <LiveActivityBar title="Discovery call" subtitle="Raycast" startsAt="2026-10-20T10:00:00" where="Google Meet"
 *     people="Priya, Sam Okafor" onJoin={join} onDismiss={hide} />
 *
 * `now` makes the clock controlled (a demo, a test): pass the current time in ms and the bar shows it; leave it
 * out and the bar keeps its own clock. Screen readers hear the time at sensible moments (10, 5 and 1 minute, and
 * the start), never every second.
 */
type LiveActivityBarProps = {
  title: string;
  subtitle?: string | undefined;
  startsAt: string | number | Date;
  /** the current time in ms, for a controlled clock; omit to let the bar tick by itself */
  now?: number | undefined;
  /** where it happens ("Google Meet", "Room 4") */
  where?: string | undefined;
  /** who is in it, in words */
  people?: React.ReactNode;
  joinLabel?: string | undefined;
  onJoin?: (() => void) | undefined;
  onDismiss?: (() => void) | undefined;
  className?: string | undefined;
};

/** How long a started event keeps saying "Now" before it reads as running. */
const NOW_FOR = 5 * 60e3;

function when(ms: number) {
  if (ms <= 0) return ms > -NOW_FOR ? "Now" : "Started";
  if (ms < 60e3) return `in ${Math.ceil(ms / 1000)}s`;
  const m = Math.ceil(ms / 60e3);
  return m < 60 ? `in ${m} min` : `in ${Math.floor(m / 60)} h ${m % 60 ? `${m % 60} min` : ""}`.trim();
}
/** What a screen reader hears, only when it changes: a few moments, not a ticker. */
function spoken(ms: number) {
  if (ms <= 0) return "Starting now";
  const m = Math.ceil(ms / 60e3);
  return [10, 5, 1].includes(m) ? `${m} ${m === 1 ? "minute" : "minutes"} to go` : "";
}

const NEVER_CHANGES = () => () => {};
/**
 * False while the page is built, true once the browser has it. A page can be rendered an hour before it is
 * read, and in another zone, so nothing taken from this machine's clock or locale is written into the HTML:
 * the first render in the browser repeats what the server sent, and the real time arrives right after.
 */
function useMounted() {
  return React.useSyncExternalStore(NEVER_CHANGES, () => true, () => false);
}

/** The time now, or null until the browser has the page. A caller that passes `now` sets it for both. */
function useClock(controlled: number | undefined, target: number, mounted: boolean) {
  const [own, setOwn] = React.useState(() => Date.now());
  React.useEffect(() => {
    if (controlled != null) return;
    /* one tick at a time: every second in the last minute and a half, otherwise every ten, so nothing renders
       more than it must */
    const id = setTimeout(() => setOwn(Date.now()), target - own < 90e3 ? 1000 : 10e3);
    return () => clearTimeout(id);
  }, [controlled, target, own]);
  if (controlled != null) return controlled;
  return mounted ? own : null;
}

function LiveActivityBar({ title, subtitle, startsAt, now, where, people, joinLabel = "Join", onJoin, onDismiss, className }: LiveActivityBarProps) {
  const target = new Date(startsAt).getTime();
  const mounted = useMounted();
  const t = useClock(now, target, mounted);
  const left = t === null ? null : target - t;
  const label = left === null ? "" : when(left);
  const live = left !== null && left <= 0 && left > -NOW_FOR;
  const [open, setOpen] = React.useState(false);
  const [gone, setGone] = React.useState(false);
  const cardId = React.useId();
  /* what a screen reader hears changes only at the moments worth saying */
  const say = left === null ? "" : spoken(left);
  const [heard, setHeard] = React.useState("");
  if (say && say !== heard) setHeard(say);
  const dismiss = () => {
    setGone(true);
    setOpen(false);
    onDismiss?.();
  };
  if (gone) return null;
  return (
    <div
      data-slot="live-activity-bar"
      data-live={live || undefined}
      data-ns-moves=""
      className={cn(
        "flex w-full flex-col overflow-hidden rounded-[var(--ns-radius-lg)] bg-[var(--ns-ink)] text-[var(--ns-canvas)] shadow-[var(--ns-shadow-float)] [animation:ns-toast-in_var(--ns-time-toast)_var(--ns-ease)]",
        className,
      )}
    >
      <div className="flex min-h-11 items-center gap-1 pr-1.5 pl-1">
        <button
          type="button"
          aria-expanded={open}
          aria-controls={cardId}
          onClick={() => setOpen((o) => !o)}
          className="flex min-w-0 flex-1 cursor-pointer items-center gap-2.5 rounded-[calc(var(--ns-radius-lg)-4px)] py-2 pr-2 pl-2.5 text-left outline-hidden focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-[var(--ns-canvas)]"
        >
          {/* the live mark: a quiet dot that takes the signal colour once, when the event starts */}
          <span
            aria-hidden
            data-ns-still=""
            className={cn(
              "size-2 shrink-0 rounded-full bg-[color-mix(in_oklab,var(--ns-canvas)_55%,transparent)] [transition:background-color_var(--ns-time-color)]",
              live && "bg-[var(--ns-ok)] [animation:ns-live-pulse_1.2s_var(--ns-ease)_1]",
            )}
          />
          <span className="flex min-w-0 flex-1 items-baseline gap-1.5 text-[length:var(--ns-text-small)]">
            <b className="truncate font-[number:var(--ns-weight-medium)]">{title}</b>
            {subtitle && <span className="truncate text-[color-mix(in_oklab,var(--ns-canvas)_68%,transparent)]">· {subtitle}</span>}
          </span>
          {/* The countdown is read from the clock, so a page built now and opened later renders two different
              words here, on purpose: React is told to keep the one the reader's own clock gives. */}
          <span className={cn("shrink-0 text-[length:var(--ns-text-small)] tabular-nums", live ? "font-[number:var(--ns-weight-medium)]" : "text-[color-mix(in_oklab,var(--ns-canvas)_78%,transparent)]")}>{label}</span>
          <ChevronUp aria-hidden className={cn("size-3.5 shrink-0 opacity-60 [transition:rotate_var(--ns-time-menu)_var(--ns-ease)]", !open && "rotate-180")} />
        </button>
        {onJoin && (
          <button
            type="button"
            onClick={onJoin}
            className="h-8 shrink-0 cursor-pointer rounded-[calc(var(--ns-radius-lg)-6px)] bg-[var(--ns-canvas)] px-3 text-[length:var(--ns-text-small)] font-[number:var(--ns-weight-medium)] text-[var(--ns-ink)] outline-hidden [transition:filter_var(--ns-time-color)] hover:brightness-95 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ns-canvas)]"
          >
            {joinLabel}
          </button>
        )}
      </div>
      <Reveal open={open}>
        <div id={cardId} className="flex items-end gap-3 border-t border-[color-mix(in_oklab,var(--ns-canvas)_14%,transparent)] px-3.5 pt-2.5 pb-3 text-[length:var(--ns-text-small)]">
          <dl className="m-0 grid min-w-0 flex-1 grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1">
            {where && (
              <>
                <dt className="text-[color-mix(in_oklab,var(--ns-canvas)_60%,transparent)]">Where</dt>
                <dd className="m-0 truncate">{where}</dd>
              </>
            )}
            {people && (
              <>
                <dt className="text-[color-mix(in_oklab,var(--ns-canvas)_60%,transparent)]">Who</dt>
                <dd className="m-0 truncate">{people}</dd>
              </>
            )}
            <dt className="text-[color-mix(in_oklab,var(--ns-canvas)_60%,transparent)]">Starts</dt>
            {/* The zone and locale are the reader's, which the machine building the page cannot know, so the
                time waits for the browser even when the caller sets `now`. */}
            <dd className="m-0 tabular-nums">{mounted ? new Date(target).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) : ""}</dd>
          </dl>
          {onDismiss && (
            <Button size="sm" variant="ghost" onClick={dismiss} className="text-[color-mix(in_oklab,var(--ns-canvas)_72%,transparent)] hover:not-disabled:bg-[color-mix(in_oklab,var(--ns-canvas)_12%,transparent)] hover:not-disabled:text-[var(--ns-canvas)]">
              <X aria-hidden />
              Dismiss
            </Button>
          )}
        </div>
      </Reveal>
      <span role="status" aria-live="polite" className="sr-only">
        {heard ? `${title}: ${heard}` : ""}
      </span>
    </div>
  );
}

export { LiveActivityBar, type LiveActivityBarProps };
```

The foundation (the tokens listed above, keyframes and motion levels) installs once with the first component; its CSS is public at https://notchset.dev/r/notchset-foundation.json.
