Micro-interactions

Live Activity

A live activity tracker in one black shape. A timer, a download, a delivery, a song and an AI agent take turns in it, and tapping it opens a full card. The text fades out before the shape moves and comes back after it stops, so it never stretches during the resize. The small pill and the big card share one clock and one state, so if you pause in the card, the pill is paused too. The agent is the main show. Three sparkles circle on a tilted orbit, the front one big and the back ones small, and they spin faster on every new step. The pill widens to show each new step's name, then shrinks back to the step count, and the card types out the command the agent is running.

Install

bun add motion lucide-react clsx tailwind-merge

Then copy 4 files into your project:

  • components/registry/live-activity/live-activity.tsx
  • components/registry/live-activity/activities.tsx
  • hooks/use-animation-loop.ts
  • lib/utils.ts

Props

PropTypeDefaultDescription
activity"media" | "timer" | "download" | "delivery" | "agent""agent"Which activity holds the island. Changing it morphs the shell straight to that activity's pill and switches the cycle off — a hand-picked activity that a timer replaces four seconds later was never really picked.
autoCyclebooleantrueRotate through the activities on a timer. The rotation stands still while the island is expanded, hovered or holding focus — nothing should change under a pointer that is about to tap it. Switching it off returns the island to `activity`, so the control and the island never disagree.
cycleIntervalnumber4How long each activity holds the island before the next takes over. Under about three seconds there is no time to read the number before it becomes a different one.
stiffnessnumber420How hard the shell springs toward its new size. The pill-to-card swell is the largest move the island makes, so this is what decides whether it reads as a drop or a crawl.
dampingnumber25How fast the spring settles. The default leaves one small overshoot, which is what sells the shape as liquid rather than a box being resized; under about 18 it wobbles on every activity swap.
contentBlurnumber6Blur the content dissolves through on its way in and out. It hides the frames where the outgoing and incoming views overlap; at 0 the swap reads as a plain crossfade.
accentstring (hex)"#a855f7"Progress rings, the download bar, the agent's working state and the focus outline. The timer and delivery keep their own tints so you can tell the activities apart at a glance.

What It Demonstrates

Morph
One shape smoothly turns into another shape, e.g. Dynamic Island.
Layout animation
When an element's size or position changes, it animates to the new spot instead of snapping.
Spring
Motion driven by physics (tension, mass, damping) rather than a set duration.
Bounce
A spring that overshoots and settles, adding playfulness.
Crossfade
One element fades out as another fades in, in the same spot.
Blur
A blur filter used to soften an element or mask tiny imperfections.
Interruptible animation
An animation that can be smoothly redirected mid-flight instead of finishing first.
Press / Tap feedback
A subtle scale-down when an element is clicked, so it feels physical.
Tabular numbers
Fixed-width digits so numbers don't shift around as they change. Essential for tickers, timers, and counters.
Number ticker
Digits rolling or counting up to a value.
Skeleton / Shimmer
A placeholder with a moving sheen shown while content loads.
Typewriter
Text appearing one character at a time, as if being typed.
Reduced motion
Respecting the user's prefers-reduced-motion setting by toning down or removing motion.

Related Components

Appears In