A ticking clock whose changing digits roll into place
pnpm dlx shadcn@latest add https://notchset.dev/r/rolling-clock.jsonA clock that ticks: only the digits that change turn, the short way.
Every shadcn style · one file
Import it and pass your content. The props that matter most are listed next.
"use client";
import * as React from "react";
import { RollingClock } from "@/components/ui/notchset/rolling-clock";
import { Spinner } from "@/components/ui/notchset/spinner";
/*
* Three clocks ticking for real, as an app ticks them: a live session counting up in m:ss, a run's elapsed time in
* h:mm:ss (its hour reserved, so the pill never widens), and an undo countdown that runs down to 0:00 and starts
* again. Only the digits that change turn, the short way; the colon never moves. The knobs show the clock as a time
* of day instead, in 24 or 12 hours, with or without its seconds.
*/
/* a second ticks on the second, so the clocks turn together */
function useTick() {
const [n, setN] = React.useState(0);
React.useEffect(() => {
const id = window.setInterval(() => setN((x) => x + 1), 1000);
return () => window.clearInterval(id);
}, []);
return n;
}
/* the time of day where the page is read, in seconds since midnight, ticking */
function useNow(tick: number) {
const [start] = React.useState(() => {
const d = new Date();
return d.getHours() * 3600 + d.getMinutes() * 60 + d.getSeconds();
});
return start + tick;
}
export default function RollingClockDemo() {
const shows = "duration" as "duration" | "time";
const hourCycle = ("24" as string) === "12" ? 12 : 24;
const seconds = true;
const tick = useTick();
const now = useNow(tick);
const undo = 5 - (tick % 6);
const [undone, setUndone] = React.useState(false);
return (
<div className="flex flex-col items-center gap-8 pb-12">
<div className="flex flex-col items-center gap-2">
<RollingClock
variant={shows}
seconds={shows === "time" ? now : 12 * 60 + 48 + tick}
hourCycle={hourCycle}
showSeconds={seconds}
label={shows === "time" ? "Time now" : "Live session"}
/* its digit windows reach 0.2em past the line: the room is laid out, so a turning digit never meets the caption */
className="pb-[0.2em] font-[family-name:var(--ns-font-display)] text-[length:var(--ns-text-giant)] leading-none tracking-[var(--ns-tracking-display)] text-[var(--ns-ink)]"
/>
<span className="text-[length:var(--ns-text-small)] text-[var(--ns-ink-3)]">{shows === "time" ? "Time now" : "Live session"}</span>
</div>
<span className="inline-flex items-center gap-2 rounded-[var(--ns-radius-full)] bg-[var(--ns-raised)] px-3 py-1.5 text-[length:var(--ns-text-small)] text-[var(--ns-ink)] shadow-[var(--ns-bezel)]">
<Spinner size="sm" />
Researching
<RollingClock seconds={3757 + tick} format="h:mm:ss" label="Elapsed" className="text-[var(--ns-ink-2)]" />
</span>
<span className="inline-flex items-center gap-4 rounded-[var(--ns-radius-lg)] bg-[var(--ns-ink)] py-1.5 ps-4 pe-1.5 text-[length:var(--ns-text-small)] text-[var(--ns-canvas)] shadow-[var(--ns-shadow-float)]">
{undone ? "Deal back in Negotiation" : "Deal marked lost"}
{!undone && <RollingClock seconds={undo} label="Time left to undo" className="opacity-70" />}
<button type="button" data-ns-press="" onClick={() => setUndone((u) => !u)} className="rounded-[var(--ns-radius-sm)] bg-[color-mix(in_oklab,var(--ns-canvas)_14%,transparent)] px-2.5 py-1 font-[number:var(--ns-weight-medium)] text-[var(--ns-canvas)] [transition:background-color_var(--ns-time-color)] hover:bg-[color-mix(in_oklab,var(--ns-canvas)_24%,transparent)]">
{undone ? "Mark lost" : "Undo"}
</button>
</span>
</div>
);
}"use client";
import * as React from "react";
import { RollingClock } from "@/components/ui/notchset/rolling-clock";
import { Spinner } from "@/components/ui/notchset/spinner";
/*
* Three clocks ticking for real, as an app ticks them: a live session counting up in m:ss, a run's elapsed time in
* h:mm:ss (its hour reserved, so the pill never widens), and an undo countdown that runs down to 0:00 and starts
* again. Only the digits that change turn, the short way; the colon never moves. The knobs show the clock as a time
* of day instead, in 24 or 12 hours, with or without its seconds.
*/
/* a second ticks on the second, so the clocks turn together */
function useTick() {
const [n, setN] = React.useState(0);
React.useEffect(() => {
const id = window.setInterval(() => setN((x) => x + 1), 1000);
return () => window.clearInterval(id);
}, []);
return n;
}
/* the time of day where the page is read, in seconds since midnight, ticking */
function useNow(tick: number) {
const [start] = React.useState(() => {
const d = new Date();
return d.getHours() * 3600 + d.getMinutes() * 60 + d.getSeconds();
});
return start + tick;
}
export default function RollingClockDemo() {
const shows = "duration" as "duration" | "time";
const hourCycle = ("24" as string) === "12" ? 12 : 24;
const seconds = true;
const tick = useTick();
const now = useNow(tick);
const undo = 5 - (tick % 6);
const [undone, setUndone] = React.useState(false);
return (
<div className="flex flex-col items-center gap-8 pb-12">
<div className="flex flex-col items-center gap-2">
<RollingClock
variant={shows}
seconds={shows === "time" ? now : 12 * 60 + 48 + tick}
hourCycle={hourCycle}
showSeconds={seconds}
label={shows === "time" ? "Time now" : "Live session"}
/* its digit windows reach 0.2em past the line: the room is laid out, so a turning digit never meets the caption */
className="pb-[0.2em] font-[family-name:var(--ns-font-display)] text-[length:var(--ns-text-giant)] leading-none tracking-[var(--ns-tracking-display)] text-[var(--ns-ink)]"
/>
<span className="text-[length:var(--ns-text-small)] text-[var(--ns-ink-3)]">{shows === "time" ? "Time now" : "Live session"}</span>
</div>
<span className="inline-flex items-center gap-2 rounded-[var(--ns-radius-full)] bg-[var(--ns-raised)] px-3 py-1.5 text-[length:var(--ns-text-small)] text-[var(--ns-ink)] shadow-[var(--ns-bezel)]">
<Spinner size="sm" />
Researching
<RollingClock seconds={3757 + tick} format="h:mm:ss" label="Elapsed" className="text-[var(--ns-ink-2)]" />
</span>
<span className="inline-flex items-center gap-4 rounded-[var(--ns-radius-lg)] bg-[var(--ns-ink)] py-1.5 ps-4 pe-1.5 text-[length:var(--ns-text-small)] text-[var(--ns-canvas)] shadow-[var(--ns-shadow-float)]">
{undone ? "Deal back in Negotiation" : "Deal marked lost"}
{!undone && <RollingClock seconds={undo} label="Time left to undo" className="opacity-70" />}
<button type="button" data-ns-press="" onClick={() => setUndone((u) => !u)} className="rounded-[var(--ns-radius-sm)] bg-[color-mix(in_oklab,var(--ns-canvas)_14%,transparent)] px-2.5 py-1 font-[number:var(--ns-weight-medium)] text-[var(--ns-canvas)] [transition:background-color_var(--ns-time-color)] hover:bg-[color-mix(in_oklab,var(--ns-canvas)_24%,transparent)]">
{undone ? "Mark lost" : "Undo"}
</button>
</span>
</div>
);
}This example also uses Spinner. This command installs them with it, so the example pastes as it is:
pnpm dlx shadcn@latest add https://notchset.dev/r/rolling-clock.json https://notchset.dev/r/spinner.jsoncomponents/ui/notchset/rolling-clock.tsx
LevelAtom: uses no other piece.
Made ofNothing else from the library: the foundation alone.
Free, no account or key. One command for every shadcn style. With the @notchset registry added, @notchset/<name> works too.
Works with React 18.3 or 19 on Tailwind CSS v4, in any shadcn project. What's tested
The CLI adds the styles to the CSS file named in components.json (tailwind.css). Check that it points at your global stylesheet, that the project uses Tailwind CSS v4, and that the file is imported in your root layout. Installed by hand: paste styles.css into that file.
seconds–
numberthe reading in whole seconds: a duration (elapsed or left), or with variant "time" the seconds since midnight
variant"duration"
"duration" | "time"duration (the default): m:ss or h:mm:ss; time: a time of day
format"m:ss"
"m:ss" | "h:mm:ss"a duration's form: m:ss (the default; past an hour it reads h:mm:ss) or h:mm:ss, its hour reserved from the start
hourCycle24
12 | 24a time of day's hours: 24 (the default) or 12, with AM or PM after it
showSecondsfalse
booleana time of day with its seconds (a duration always has them)
label–
stringwhat the clock measures, for assistive tech ("Elapsed", "Time left to undo")
labels–
Partial<RollingClockLabels>the words for 12-hour time, English by default
Three usesa live session's timer · an undo countdown in a toast · a run's elapsed time in a header pill
Give your coding assistant the Markdown guide instead of screenshots.
https://notchset.dev/api/mcp (setup)v1.1.0 · 2026-11-17
Ships motion.ts (EASE), which it now uses.
v1.0.0 · 2026-11-09
Released free with the Notchset system.