Bruno DelorenceBruno
Appearance
Appearance

Choose your reading theme.

Contact

Subscription pulse

New

A subscriptions dashboard where one brushed window of days recounts every card, with a plan ring and a week of purchases as 3D bars you can orbit.

subscription-pulse/subscription-pulse.tsx
Live · interactive
LMAKTO

Purchases

Total7,040+8.6%

Plan mix

Net growth

+727+98.6%Gained +2,098Lost −1,371

Purchase rhythm

Drag to orbit · double-click to reset

Top accounts

AccountPlan
Enterprise48$9,420.00
Enterprise39$6,180.50
Business31$5,212.00
Business27$4,890.25
Team22$3,104.00
Team18$2,266.75
Pro12$1,438.00
Pro9$712.40

The live component, numbered part by part. Every measurement is read from it as it is drawn. Point at a row to outline its part, or at a part to find its row.

The choices it offers, each value drawn live and the default marked, with how to pick one.

When to use

  • A subscription business’s overview: purchases, the plan mix, net growth and when people buy, on one screen.
  • A window of days that should drive every card at once, so a reader can drag back to a launch and see everything recount.
  • Readers who explore: hover any day, rest on a plan, turn the week around, sort the biggest accounts.
  • A product tour or a case study, where the 3D rhythm and the brush are worth showing moving.

When not to use

  • A single number for a status bar or a mobile widget. Show one stat with its change; a dashboard is too much.
  • Precise reporting someone will copy into a spreadsheet. Give a table with export; the charts round by eye.
  • Hourly or real-time data: the brush works in whole days and the cards recount on every move.
  • More than two series on Purchases. Past two lines the crosshair’s tooltip and the legend stop being readable; split into cards.

One window for every card

  • The brush sets it: drag the box, stretch an end (14 days at least), or focus it and use the arrows; Page Up and Down move a week.
  • Every card recounts: the totals and their changes, the net growth line, the plans’ growth and the rhythm’s counts.
  • Changes compare the window with the one of the same length just before it; with no earlier days there is no change shown.

Orbiting the rhythm

  • Drag turns it around (yaw) and tips it (pitch, 14° to 84°); double-click or Home glides it back in about half a second.
  • Flat lays the bars down over 600 ms and looks straight down: the same cells become a heatmap.
  • The busiest hour is named in a pill over its bar, which follows it as the view turns.

Each one drawn with the component itself, used well or badly.

The words are the card titles, the series and plan names, the axes and the counts.

  • Card titles in sentence case, a noun or two: Purchases, Plan mix, Net growth, Purchase rhythm.
  • Axes and deltas in monospace caps: AUG 10, +6.1%, PEAK · TUE 08:00, so the numbers line up.
  • Signed numbers with a true minus: +1,260, −5,875.
  • Plan names as the product calls them, the same in the ring, the rows and the table.

You can add this component with the shadcn CLI or by hand:

Into components/subscription-pulse of any React project, with no setup:

Terminal
npx shadcn@latest add https://brunodelorence.com/r/subscription-pulse.json

Either way it needs React 19.2 and a bundler that supports CSS Modules, such as Next.js or Vite. It has a dark colour scheme: it follows your page’s color-scheme, light unless the page sets one, or its colorScheme prop, with nothing to configure. Browsers without light-dark() show it light.

Usage

subscriptions-page.tsx
import { SubscriptionPulse } from './subscription-pulse';export function SubscriptionsPage() {  return (    <SubscriptionPulse      autoplay={false}      defaultRange="30D"      onWindowChange={({ from, to }) => console.log(from, to)}    />  );}

Each state below is a live instance, locked so you can study it.

The pieces it is built from, each with its measurements read live.

A subscriptions dashboard in an app’s frame, at home in the dark. Purchases draws new subscriptions and add-ons day by day over a strip of the whole year: drag the window on the strip, stretch it or pick 30 days, 90 days or 12 months, and every total, change and chart on the page recounts. Plan mix is a ring cut into one arc per plan; rest on a plan and the ring and its middle number turn to it. Net growth runs the gains less the losses as one rising line. Purchase rhythm stands the week up as 168 orange bars, weekday by hour, that you drag to orbit, or lays them flat into a heatmap. The biggest accounts close the page in a table you can sort and filter.

  • One window of whole days, kept by the dashboard, feeds every card: a year of invented days ending 1 November 2026 is built once from a seeded random stream, so the server and the browser draw the same numbers, and each card sums the days inside the window.
  • Changes compare the window with the one of the same length just before it; when fewer than 7 earlier days exist (12 months), no change is shown rather than a made-up one.
  • The range buttons glide the window to their days over 460 ms (ease-out cubic), redrawing on every frame so the totals count along. The brush under Purchases is the year as a strip smoothed over 7 days; its window moves by drag with pointer capture, its ends stretch it to no less than 14 days, and all three are sliders for the keyboard.
  • The line charts are SVG drawn in real px from their own width (a ResizeObserver), so a 1.6 px line stays 1.6 px at any size. The axis top rounds up to 1, 2, 2.5 or 5 times a power of ten in four steps; ticks are weekly up to 45 days, every two weeks up to 125, then monthly.
  • Plan mix is five SVG arcs, 13 px wide on a 76 px radius with round caps, the gaps cut wider by the caps’ reach so they read even. Holding a plan dims the others to 18% and counts the middle to its number over 380 ms.
  • Purchase rhythm is a canvas with a projection of its own: each bar is a box turned by yaw and tipped by pitch (home 20° and 48°), drawn back to front with only the sides facing the camera, shaded 74% and 52% towards a floor colour. One scale fits the home view, so orbiting never zooms. Flat eases pitch to 90°, yaw to 0 and the heights to almost nothing over 600 ms (ease-in-out cubic).
  • The camera lives in refs, so a drag redraws on the next animation frame without a React render; the peak and hover pills are HTML moved by their transform to each bar’s projected top. Hovering finds the bar by testing the drawn faces front to back.
  • Layout is by container queries on the root: sidebar and two rows of cards (wide over narrow, then narrow over wide, 1.4 : 1) from 1000 px, the sidebar sliding over the page below that, and one column of cards under 820 px.
  • While on screen and untouched, a demo pointer presses the ranges, reads Purchases, drags the brush back, reads two plans, orbits the rhythm, lays it flat and reads Net growth; any input stops it.
  • Every colour is a light-dark() token on the root, and the canvas reads its colours through hidden probe elements, watching for theme changes on the page, so it follows a theme toggle without a reload.
PropTypeDefaultDescription
defaultRange'30D' | '90D' | '12M''90D'The window it opens on, ending on the last day.
defaultView'3d' | 'flat''3d'The rhythm at first: bars to orbit, or the flat heatmap.
defaultPlan'starter' | 'pro' | 'team' | 'business' | 'enterprise' | nullnullA plan held up in Plan mix at first, as a click on its row would.
onWindowChange(window: { from: string; to: string; days: number }) => void—Called 250 ms after the window stops moving, with its first and last days as YYYY-MM-DD.
autoplaybooleantrueWhile on screen and untouched, a demo pointer walks through the cards; any input from the reader stops it.
colorScheme'light' | 'dark' | 'system'—Light or dark colours, or the reader’s; without it, the page’s color-scheme.
classNamestring—A class for the root.

Keyboard

  • The Purchases and Net growth plots are sliders over the window’s days: Left and Right move the crosshair a day, Shift a week, Home and End go to either end.
  • The brush’s window and its two ends are sliders: arrows move a day, Page Up and Down a week, Home and End to the year’s ends.
  • The rhythm field reads each hour with the arrows (hours left and right, days up and down) with a ring on the bar; Shift and the arrows turn the view, Home turns it back.
  • Range buttons, the 3D and Flat buttons, plan rows and sort headers are buttons; Ask opens a menu with arrows and Escape.

Screen readers

  • Each card is a section named by its title. The plots’ value text reads the day: “Wed, Oct 14, 2026: 71 purchases, 18 new subscriptions, 53 add-ons”.
  • The rhythm field is an application named with the busiest hour; each move is spoken in a polite live region. The canvas, the pills and the ring’s middle are hidden; the ring is an image named with the count.
  • The table has column headers with aria-sort; the range and view buttons carry aria-pressed.

Motion

With reduced motion the range glides, the ring’s count, the flat transition and the camera’s return happen at once, and the demo does not play.

In this build

  • Landmarks and headings: the sidebar is a labelled aside with a nav, the page a main with an h1 in its breadcrumb, and every card a section named by its h2.
  • The Purchases and Net growth plots are sliders over the window’s days whose value text reads the day; Left and Right move a day, Shift a week, Home and End to either end.
  • The brush’s window and its two ends are sliders with their dates as value text: arrows move a day, Page Up and Down a week.
  • The rhythm field takes the arrow keys to read each hour (spoken in a polite live region, with a ring on the bar), Shift and the arrows to orbit, Home to turn back. The canvas is hidden; the field is named with the busiest hour.
  • Range and view buttons carry aria-pressed, plan rows are buttons, the table’s sort headers set aria-sort, and Ask is a menu with arrow keys and Escape.
  • Every control shows a focus ring on keyboard focus. With reduced motion the glides, the count-up, the flat transition and the camera’s return happen at once, and the demo does not play.

The complete source behind this demo. Open source under the MIT license, © 2026 Bruno Delorence: copy it, change it, ship it.

subscription-pulse.tsx
// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import {  useCallback,  useEffect,  useId,  useEffectEvent,  useRef,  useState,  type KeyboardEvent,} from 'react';import { Accounts } from './accounts';import { easeInOut, easeOut, tween, useReducedMotion, useWidth } from './chart-kit';import { DAYS, compare, isoDate, shortDate, type PlanId, type Window } from './data';import { DemoPointer, runDemo, type Point } from './demo-pointer';import { Icon, type IconName } from './icons';import { NetGrowth } from './net-growth';import { PlanMix } from './plan-mix';import { MIN_DAYS, Purchases } from './purchases';import { Rhythm } from './rhythm';import { useAutoplay } from './use-autoplay';import styles from './subscription-pulse.module.css';
purchases.tsx
// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import { useEffect, useRef, useState, type KeyboardEvent, type PointerEvent, useId } from 'react';import { areaPath, linePath, niceTop, useWidth } from './chart-kit';import {  DAYS,  MONTH_STARTS,  YEAR,  compare,  fmt,  longDate,  monthOf,  pct,  shortDate,  type Window,} from './data';import styles from './subscription-pulse.module.css';/* * Purchases: the window's total and its two series, new subscriptions (orange) and add-ons (the * ink colour), drawn day by day, with a crosshair that reads any day, and under them the whole * year as a strip with the window on it, to drag, stretch or move with the keys.
plan-mix.tsx
// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import { useEffect, useRef, useState, useId } from 'react';import { easeOut, tween, useReducedMotion } from './chart-kit';import { ACTIVE, PLANS, fmt, planGrowth, type PlanId, type Window } from './data';import { Delta } from './purchases';import styles from './subscription-pulse.module.css';/* * Plan mix: the active subscribers as a ring cut into one arc per plan, clockwise from the top, * and the plans as rows under it. Hovering or focusing a row (or an arc) dims the other arcs and * the middle counts up or down to that plan's subscribers; a click keeps it there. */const SIZE = 184;const R = 76;const STROKE = 13;/** The round caps reach STROKE / 2 past each end, so the gap is cut wider than it looks. */const GAP = ((STROKE + 5) / R) * (180 / Math.PI);function arc(from: number, to: number) {  const point = (deg: number) => {
net-growth.tsx
// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import { useEffect, useRef, useState, type KeyboardEvent, useId } from 'react';import { areaPath, linePath, useWidth } from './chart-kit';import { YEAR, compare, longDate, shortDate, signed, type Window } from './data';import { Delta } from './purchases';import styles from './subscription-pulse.module.css';/* * Net growth: subscribers gained less subscribers lost over the window, and the running sum day * by day as one rising line over a soft fill, ending on an orange dot at the window's last day. */const H = 236;const TOP = 14;const BOTTOM = 28;export function NetGrowth({ window }: { window: Window }) {  const uid = useId().replace(/[^\w-]/g, '');  const { start, end } = window;  const { now, change } = compare(window);  const { ref: frame, width } = useWidth<HTMLDivElement>();
rhythm.tsx
// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import {  useEffect,  useMemo,  useRef,  useState,  type KeyboardEvent,  type PointerEvent,  useId,} from 'react';import { easeInOut, tween, useReducedMotion } from './chart-kit';import { DAY_LONG, DAY_NAMES, HOURS, RHYTHM, fmt } from './data';import { Icon } from './icons';import styles from './subscription-pulse.module.css';/* * Purchase rhythm: when in the week people buy, as a field of 7 × 24 bars (weekday × hour) seen * from above at an angle, drawn on a canvas with a projection of its own. Drag to orbit, double- * click to go back; Flat lays the bars down and looks straight down on them, so the same cells * become a heatmap. *
accounts.tsx
// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import { useState, useId } from 'react';import { ACCOUNTS, PLANS, money, type Account } from './data';import { Icon } from './icons';import styles from './subscription-pulse.module.css';/* * Top accounts: the biggest customers as a table, sorted by seats or by lifetime spend (a header * click flips the order), filtered as you type a name or a city. The bar beside each spend is * its share of the biggest one. */type Sort = 'seats' | 'spend';const initials = (name: string) =>  name    .split(/[\s&]+/)    .filter(Boolean)    .slice(0, 2)    .map((word) => word[0])    .join('')
chart-kit.ts
// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import { useEffect, useRef, useState, useSyncExternalStore } from 'react';/* * What the charts share: their own width (they draw in real px, so a 1 px line stays 1 px at any * size), a round top for an axis, the reduced-motion setting and a short tween. *//** The element's content width in px, kept up to date; 0 until it is measured. */export function useWidth<T extends HTMLElement>() {  const ref = useRef<T>(null);  const [width, setWidth] = useState(0);  useEffect(() => {    const element = ref.current;    if (!element) return;    // Measured at once too, so a remount draws without waiting for the observer's first call.    setWidth(Math.round(element.getBoundingClientRect().width));    const observer = new ResizeObserver(([entry]) => {      setWidth(Math.round(entry.contentRect.width));    });    observer.observe(element);
data.ts
// Copyright (c) 2026 Bruno Delorence. MIT License./* * The dashboard's numbers: a year of days ending on Sunday 1 November 2026, built once from a * seeded random stream so the server and the browser draw the same thing. Every card reads a * window of these days (the brush's), so moving the window recounts every total. *//** A small seeded generator (mulberry32): the same stream on every load. */function seeded(seed: number) {  let state = seed >>> 0;  return () => {    state = (state + 0x6d2b79f5) >>> 0;    let t = state;    t = Math.imul(t ^ (t >>> 15), t | 1);    t ^= t + Math.imul(t ^ (t >>> 7), t | 61);    return ((t ^ (t >>> 14)) >>> 0) / 4294967296;  };}export const DAYS = 365;const DAY_MS = 86_400_000;/** Day 0 is Sunday 2 November 2025; the last day is Sunday 1 November 2026. */const FIRST = Date.UTC(2025, 10, 2);
icons.tsx
// Copyright (c) 2026 Bruno Delorence. MIT License./* * The dashboard's icons, drawn on one 16-unit grid as 1.3-unit strokes in currentColor, so they * take the text colour of whatever holds them. All decorative: the control beside or around an * icon carries the words. */export type IconName =  | 'panel'  | 'info'  | 'search'  | 'grid'  | 'inbox'  | 'compass'  | 'file'  | 'trend'  | 'bars'  | 'clock'  | 'users'  | 'receipt'  | 'smile'  | 'table'  | 'gear'
demo-pointer.tsx
// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import type { CSSProperties, Ref } from 'react';/* * The demo's pointer, and the steps that move it. A demo is a script of awaited steps: wait, or * glide the pointer somewhere. Stopping the demo (the reader takes over, or it scrolls away) ends * the step in progress at once: its promise rejects, which ends the script right there, and the * pointer fades out. * * Each glide is a curved flight played by the Web Animations API, so nothing runs frame by frame. * The points of the flight are handed to whoever wants to move along with it (nothing here uses * them yet). The arrow and the hand are HTML boxes * that swap by their visibility: a change of style inside an SVG would lay the SVG out again. */export type Point = { x: number; y: number };/** A glide's path and timing, for an animation that plays along with it. */export type Flight = { points: Point[]; timing: KeyframeAnimationOptions };export type Demo = {
use-autoplay.ts
// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import { useCallback, useEffect, useRef, useState } from 'react';/* * When a demo may play on its own: while part of it is on screen and the tab is visible, never * under reduced motion, and never again once the reader has used it: `take()` hands it to the * reader for good (until the component mounts again), so it can't come back on its own. */export function useAutoplay<T extends HTMLElement>() {  const ref = useRef<T>(null);  const [visible, setVisible] = useState(false);  const [reduced, setReduced] = useState(true);  const [taken, setTaken] = useState(false);  useEffect(() => {    const element = ref.current;    if (!element) return;    let onScreen = false;    const update = () => setVisible(onScreen && !document.hidden);    const observer = new IntersectionObserver(      ([entry]) => {
subscription-pulse.module.css
/* Copyright (c) 2026 Bruno Delorence. MIT License. *//* Subscription pulse (subscription-pulse.tsx): a subscriptions dashboard in an app's frame. At   night (the scheme it was drawn for) near-black cards on a black frame, white type, one orange   for new subscriptions and the rhythm's busy hours; by day white cards on a pale grey frame with   the same orange.   Colours are the tokens below, light-dark(light, dark) where the two differ: the dashboard takes   the color-scheme it inherits from the page, or the one its colorScheme prop sets   (data-color-scheme). The canvas reads its colours through the probe spans at the bottom.   Layout is by container queries on the root: sidebar and two rows of two cards (wide over narrow,   then narrow over wide) from 1000 px; under that the sidebar opens over the page; under 820 px   the cards stack. Type is a sans for words and a monospace for every axis, delta and count. */.root {  --shell: #f3f3f2;  --card: #fff;  --line: #e7e7e5;  --line-2: #dcdcda;  --ink: #151515;  --ink-2: #2c2c2c;  --muted: #666664;  --faint: #7d7d7a;