A tickable list with optional times and notes for routines
Space ticks the row · Tab to the next · the done line opens them
pnpm dlx shadcn@latest add @notchset-pro/checklistA list to tick, times optional, with a note on any item.
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 { Checklist, type ChecklistItem } from "@/components/ui/notchset/checklist";
import { useLessMotion } from "@/lib/notchset/motion";
import { useSelfPlay } from "./self-play";
/*
* One morning's routine with its times. On view a tick lands on the lit row, the count rolls, and 900ms later the done
* row folds down into the quiet "2 done" line at the list's foot, whose figure rolls too. Then the hand ticks: each done
* row folds the same way, and pressing the line opens the done rows again. The quiet "Ticks fail" switch makes each
* tick come back unsaved while it is on.
*/
const ROWS: ChecklistItem[] = [
{ id: "water", at: "06:45", title: "Glass of water", by: "ticked 06:48" },
{ id: "stretch", at: "07:00", title: "Stretch, 10 min" },
{ id: "walk", at: "07:30", title: "Walk, 30 min", note: "The long loop by the river" },
{ id: "read", at: "08:00", title: "Read 20 pages" },
{ id: "plan", at: "08:30", title: "Plan the day", note: "Three things, no more" },
];
const WORDS = { title: "This morning", saving: "Saving…", unsaved: "Not saved: you're offline. Tick again to retry" };
export default function ChecklistDemo() {
const failNext = false as boolean;
return <Routine key={String(failNext)} failNext={failNext} />;
}
function Routine({ failNext }: { failNext: boolean }) {
const less = useLessMotion();
const words = WORDS;
const rows = ROWS;
const root = React.useRef<HTMLDivElement>(null);
const play = useSelfPlay(root, { beats: [600], off: less, hold: failNext });
const [ticked, setTicked] = React.useState<string[]>(["water"]);
const [busy, setBusy] = React.useState<string | null>(null);
const [unsaved, setUnsaved] = React.useState<string | null>(null);
const timer = React.useRef(0);
React.useEffect(() => () => window.clearTimeout(timer.current), []);
/* the arrival: the lit row ticked, as a hand would; with less motion it rests ticked */
const end = !play.mine && play.step < 0 && play.control === "replay" && !failNext;
React.useEffect(() => {
if (play.mine || !(play.step === 0 || end)) return;
// eslint-disable-next-line react-hooks/set-state-in-effect -- the arrival's one tick lands on its beat, as a hand's would
setTicked((t) => (t.includes("stretch") ? t : [...t, "stretch"]));
}, [play.step, play.mine, end]);
const tick = (id: string, on: boolean) => {
setUnsaved(null);
if (on && failNext) {
setBusy(id);
timer.current = window.setTimeout(() => {
setBusy(null);
setUnsaved(id);
}, 700);
return;
}
setTicked((t) => (on ? [...t.filter((x) => x !== id), id] : t.filter((x) => x !== id)));
};
const items = rows.map((r) => ({
...r,
done: ticked.includes(r.id),
busy: busy === r.id || undefined,
status:
unsaved === r.id ? (
<span className="text-[length:var(--ns-text-small)] text-[var(--ns-bad-ink)]">{words.unsaved}</span>
) : busy === r.id ? (
<span className="text-[length:var(--ns-text-small)] text-[var(--ns-ink-3)]">{words.saving}</span>
) : undefined,
}));
return (
<div ref={root} onPointerDownCapture={play.handOver} onKeyDownCapture={play.handOver} className="w-[min(100%,27.5rem)]">
{/* the whole list, open, holds the stage's height while rows fold away */}
<div className="grid grid-cols-[minmax(0,1fr)]">
<div aria-hidden ref={(el) => void (el && (el.inert = true))} className="invisible col-start-1 row-start-1 min-w-0">
<Checklist title={words.title} progress items={rows} onNote={() => {}} />
</div>
<div className="col-start-1 row-start-1 min-w-0 self-start">
<Checklist
title={words.title}
progress
fold
items={items}
onToggle={tick}
onNote={() => {}}
/>
</div>
</div>
</div>
);
}"use client";
import * as React from "react";
import { Checklist, type ChecklistItem } from "@/components/ui/notchset/checklist";
import { useLessMotion } from "@/lib/notchset/motion";
import { useSelfPlay } from "./self-play";
/*
* One morning's routine with its times. On view a tick lands on the lit row, the count rolls, and 900ms later the done
* row folds down into the quiet "2 done" line at the list's foot, whose figure rolls too. Then the hand ticks: each done
* row folds the same way, and pressing the line opens the done rows again. The quiet "Ticks fail" switch makes each
* tick come back unsaved while it is on.
*/
const ROWS: ChecklistItem[] = [
{ id: "water", at: "06:45", title: "Glass of water", by: "ticked 06:48" },
{ id: "stretch", at: "07:00", title: "Stretch, 10 min" },
{ id: "walk", at: "07:30", title: "Walk, 30 min", note: "The long loop by the river" },
{ id: "read", at: "08:00", title: "Read 20 pages" },
{ id: "plan", at: "08:30", title: "Plan the day", note: "Three things, no more" },
];
const WORDS = { title: "This morning", saving: "Saving…", unsaved: "Not saved: you're offline. Tick again to retry" };
export default function ChecklistDemo() {
const failNext = false as boolean;
return <Routine key={String(failNext)} failNext={failNext} />;
}
function Routine({ failNext }: { failNext: boolean }) {
const less = useLessMotion();
const words = WORDS;
const rows = ROWS;
const root = React.useRef<HTMLDivElement>(null);
const play = useSelfPlay(root, { beats: [600], off: less, hold: failNext });
const [ticked, setTicked] = React.useState<string[]>(["water"]);
const [busy, setBusy] = React.useState<string | null>(null);
const [unsaved, setUnsaved] = React.useState<string | null>(null);
const timer = React.useRef(0);
React.useEffect(() => () => window.clearTimeout(timer.current), []);
/* the arrival: the lit row ticked, as a hand would; with less motion it rests ticked */
const end = !play.mine && play.step < 0 && play.control === "replay" && !failNext;
React.useEffect(() => {
if (play.mine || !(play.step === 0 || end)) return;
// eslint-disable-next-line react-hooks/set-state-in-effect -- the arrival's one tick lands on its beat, as a hand's would
setTicked((t) => (t.includes("stretch") ? t : [...t, "stretch"]));
}, [play.step, play.mine, end]);
const tick = (id: string, on: boolean) => {
setUnsaved(null);
if (on && failNext) {
setBusy(id);
timer.current = window.setTimeout(() => {
setBusy(null);
setUnsaved(id);
}, 700);
return;
}
setTicked((t) => (on ? [...t.filter((x) => x !== id), id] : t.filter((x) => x !== id)));
};
const items = rows.map((r) => ({
...r,
done: ticked.includes(r.id),
busy: busy === r.id || undefined,
status:
unsaved === r.id ? (
<span className="text-[length:var(--ns-text-small)] text-[var(--ns-bad-ink)]">{words.unsaved}</span>
) : busy === r.id ? (
<span className="text-[length:var(--ns-text-small)] text-[var(--ns-ink-3)]">{words.saving}</span>
) : undefined,
}));
return (
<div ref={root} onPointerDownCapture={play.handOver} onKeyDownCapture={play.handOver} className="w-[min(100%,27.5rem)]">
{/* the whole list, open, holds the stage's height while rows fold away */}
<div className="grid grid-cols-[minmax(0,1fr)]">
<div aria-hidden ref={(el) => void (el && (el.inert = true))} className="invisible col-start-1 row-start-1 min-w-0">
<Checklist title={words.title} progress items={rows} onNote={() => {}} />
</div>
<div className="col-start-1 row-start-1 min-w-0 self-start">
<Checklist
title={words.title}
progress
fold
items={items}
onToggle={tick}
onNote={() => {}}
/>
</div>
</div>
</div>
);
}"use client";
import * as React from "react";
/*
* A demo that plays itself until the first touch: the script lives in the demo, never in the piece, which only gets
* the props a person would give it. It moves 0.4 s after the piece is first seen, then takes each step on its beat;
* off screen or paused it waits. The first press, key or focus on the piece (bind `handOver` to it; a scroll over it never counts) makes it the
* visitor's for good and drops every queued step; with less motion (`off`) it never plays and rests in its first frame.
* A host can hand it over from outside the piece too (a settings panel beside it the visitor has used): under
* <HandedOver value>, it never plays, a remount included.
*
* const play = useSelfPlay(root, { beats: [2800, 2800], loop: true, off: less });
* <div ref={root} onPointerDownCapture={play.handOver} onKeyDownCapture={play.handOver} onFocusCapture={play.handOver}>
* play.step // the step it is at, -1 before its first
* play.control // "pause" while it plays, "play" once paused (a new take), "replay" once it is over or yours
*
* Each step presses the piece's own controls (pressIn), so the script shows exactly what a hand can do.
*
* A host that shows the piece once (<PlayOnce value={{ settle }}>) changes three things: the script starts when the
* piece is first half in view and never again on coming back, it never loops, and with less motion (or `settle`) it
* takes every step at once, so the piece rests on the END of its moment. `hold` is a reason not to play at all that is
* not motion (a mode with nothing to show): it holds in every host. Under <PlayOnce value={{ active: false }}> (a look
* that is mounted but not shown) it waits until it is shown.
*/
type SelfPlayOptions = {
/** how long each step waits after the one before it, in ms; the first step waits 0.4 s after the piece is seen */
beats: readonly number[];
/** starts over after the last step; without it the script plays once and rests */
loop?: boolean | undefined;
/** no self-play at all (less motion): the piece is the visitor's from the start */
off: boolean;
/** no self-play for a reason other than motion (a mode with nothing to show), in every host */
hold?: boolean | undefined;
};
/** How a host shows the piece: once on arrival (see useSelfPlay). */
type PlayOnceHost = {
/** rest on the end at once, without playing (less motion, or a reset) */
settle?: boolean | undefined;
/** false while the piece is mounted but not shown: it waits */
active?: boolean | undefined;
};
const START = 400;
/**
* Whether a demo plays itself at all. Off: every piece rests in its first frame and is
* the visitor's from the start; nothing presses its controls for them.
*/
const SELF_PLAY: boolean = false;
/** True where the visitor has already taken the piece from outside it: nothing under it plays itself. */
const HandedOver = React.createContext(false);
/** A host that shows the piece once: play once on arrival, rest on the end (null: play as the demo asks). */
const PlayOnce = React.createContext<PlayOnceHost | null>(null);
function useSelfPlay(root: React.RefObject<Element | null>, { beats, loop: looped = false, off: still, hold = false }: SelfPlayOptions) {
const once = React.useContext(PlayOnce);
const active = once?.active !== false;
/* shown once: less motion (or a settled host) takes every step at once and rests on the end */
const quick = once != null && (still || Boolean(once.settle));
const loop = once == null && looped;
/* the first touch hands it over for good */
const [mine, setMine] = React.useState(false);
const handOver = React.useCallback(() => setMine(true), []);
const handedOver = React.useContext(HandedOver);
const off = !SELF_PLAY || hold || (quick ? false : still) || mine || (handedOver && !quick);
const [seen, setSeen] = React.useState(false);
const [paused, setPaused] = React.useState(false);
const [taken, setTaken] = React.useState(0);
const n = Math.max(1, beats.length);
const done = !loop && taken >= n;
React.useEffect(() => {
const el = root.current;
if (!active) return;
/* without an observer (an old browser, a test) it counts as seen */
if (!el || typeof IntersectionObserver === "undefined" || quick) {
const t = window.setTimeout(() => setSeen(true));
return () => window.clearTimeout(t);
}
/* shown once: first half in view starts it, and leaving never stops or restarts it */
const io = once
? new IntersectionObserver((es) => {
if (es.some((e) => e.isIntersecting && e.intersectionRatio >= 0.5)) {
setSeen(true);
io.disconnect();
}
}, { threshold: 0.5 })
: new IntersectionObserver((es) => setSeen(es.some((e) => e.isIntersecting)));
io.observe(el);
return () => io.disconnect();
}, [root, active, once, quick]);
const playing = !off && seen && active && !paused && !done;
const delay = quick ? 0 : taken === 0 ? START : (beats[taken % n] ?? START);
React.useEffect(() => {
if (!playing) return;
const t = window.setTimeout(() => setTaken((k) => k + 1), delay);
return () => window.clearTimeout(t);
}, [playing, taken, delay]);
/* one control in one place: Pause while it plays, Play (a new take) once paused, Replay once it is over or yours */
/* self-play off: never "over", so a demo rests in its FIRST frame, not its end frame */
const control: "pause" | "play" | "replay" = paused || !SELF_PLAY ? "play" : off || done ? "replay" : "pause";
return { step: taken === 0 ? -1 : (taken - 1) % n, taken, playing, control, mine, handOver, pause: () => setPaused(true) };
}
/**
* Presses a real control inside `root`, as the visitor would: the first match of `selector`, or the one whose text is
* `text`. A click only, so it never counts as the visitor's touch.
*/
function pressIn(root: Element | null, selector: string, text?: string) {
const all = [...(root?.querySelectorAll<HTMLElement>(selector) ?? [])];
(text == null ? all[0] : all.find((el) => el.textContent?.trim() === text))?.click();
}
export { HandedOver, PlayOnce, pressIn, useSelfPlay, type PlayOnceHost, type SelfPlayOptions };components/ui/notchset/checklist.tsx
This component is included with Pro.
Try the live preview above. Get Pro to install the source.
LevelOrganism: made of molecules or blocks.
Made ofButton,Checkbox,Icon button,Rolling number,Text field
Needs your registry key. Every components.json style gets the same files.
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.
The sound you hear is this page's: the piece you install plays none, and calls onFeedback on each move so you can add your own.
items–
ChecklistItem[]the rows, in order: each with its id, title, done and optional time, note and status
defaultValue–
string[]the ids ticked at first (uncontrolled): the list keeps its own ticks and items' `done` is not read
name–
stringthe form field name: a form sends each ticked row's id under it
onToggle–
(id: string, done: boolean) => voidcalled with the row's id and its new done when its tick is pressed
onNote–
(id: string, note: string) => voidleft out, rows take no notes
title"Today's routine"
stringthe list's name, read before the count ("Today's routine")
headtrue
booleanfalse: no head row (the host's section names it and carries the count)
progressfalse
booleana small ring by the head's count, filled in the Signature as rows are done and closed in ok on the last
foldfalse
booleandone rows fold away (900ms after the tick) into an "N done" line at the foot; pressing it opens them again
doneLabel"{n} done"
stringthe foot line's words ("{n}" the count)
onFeedback–
(e: FeedbackEvent) => voidcalled once per move, for your sound or haptics
Three usesa day's routine of doses or habits · a shift's opening tasks · a setup list on an empty home: connect, import, invite
Give your coding assistant the Markdown guide instead of screenshots.
https://notchset.dev/api/mcp (setup)One payment, lifetime.
v2.0.0 · 2026-10-13
Released with the Notchset system.