Quiet Status Stack
Background work, without the applause.
Your preview settings
{
"max": 3,
"auto": true
}These are the exact settings driving this demo, including sample content and simulated states. For the installable component’s public API, see Usage and Props below.
Start or advance a job, fail one, then retry it from the note or the job row.
A real browser viewport. Scroll within the preview when the sample needs more space. Configuration stays in sync between sizes.
01What it does
A restrained notification stack for long-running operations. New rows enter while existing rows make room, success can settle away, errors wait for a person, and one polite live region announces only meaningful state changes.
In this previewA fictional processing desk with four jobs. Starting, advancing, failing, retrying and opening a job all update the job record; the note stack is derived from that state, never simulated separately.
Design decisions
Existing notes are FLIP-measured when the list changes, while the new note enters on top of that movement. The stack feels like one surface rearranging, not several cards restarting.
Errors and processing work sort to the top so the visible limit never hides the item that needs attention.
The component handles timing and pause semantics; the host owns the operation. That keeps the notification honest: it cannot claim success the job has not reported.
02Install
Registry install
Run this in a React project with components.json. The component and its stylesheet land in components/lab/quiet-status-stack/.
npx shadcn@latest add https://lab.tanishk.me/r/quiet-status-stack.jsonFiles included
2- components/lab/quiet-status-stack/quiet-status-stack.tsxcomponent
- components/lab/quiet-status-stack/quiet-status-stack.cssstyles
Manual install: copy each file into the same folder and preserve its relative imports. Open the source
03Usage
"use client";
import { QuietStatusStack } from "@/components/lab/quiet-status-stack/quiet-status-stack";
export function ExportActivity({ jobs, dismiss }: { jobs: Job[]; dismiss: (id: string) => void }) {
return (
<QuietStatusStack
max={3}
onDismiss={dismiss}
items={jobs.map((job) => ({
id: job.id,
title: job.name,
detail: job.note,
status: job.status,
progress: job.status === "processing" ? job.progress : undefined,
action: job.status === "error"
? { label: "Retry", onClick: () => job.retry() }
: undefined,
autoDismissMs: job.status === "success" ? 6000 : undefined,
}))}
/>
);
}04Props
| Prop | Type | Default | Notes |
|---|---|---|---|
items | { id: string; title: string; detail?: string; status: "pending" | "processing" | "success" | "error"; progress?: number; action?: { label: string; onClick: () => void; busy?: boolean }; dismissible?: boolean; autoDismissMs?: number }[] | — | Host-owned operations in display order. Only the first `max` are shown. |
onDismiss | (id: string) => void | — | Called after the dismiss animation, or when an auto-dismiss expires. |
max | number | 4 | Maximum visible notes. |
label | string | "Background activity" | Accessible name for the stack. |
className | string | — | Forwarded to the root for local positioning. |
05Accessibility
- The stack is a labelled list of real status items; the visual state is not the only carrier.
- One visually hidden polite live region announces start, completion and failure. Progress ticks are never announced frame by frame.
- Progress uses role="progressbar" with a numeric value; indeterminate work omits aria-valuenow.
- Auto-dismiss is paused on hover and focus and resumes with the remaining time; errors do not auto-dismiss.
- Dismiss and action buttons are labelled, and reduced motion swaps the entry and movement for immediate updates.
06Source
2 files, 640 lines. The combined copy is a reference; save each file separately for use.
components/lab/quiet-status-stack/quiet-status-stack.tsx— press enter to show or hide the source
"use client";
import {
useEffect,
useLayoutEffect,
useRef,
useState,
} from "react";
import "./quiet-status-stack.css";
export type StatusTone = "pending" | "processing" | "success" | "error";
export type StatusAction = {
label: string;
onClick: () => void;
busy?: boolean;
};
export type StatusItem = {
id: string;
title: string;
detail?: string;
status: StatusTone;
/** 0–1 for determinate work. Omit for an indeterminate bar. */
progress?: number;
action?: StatusAction;
/** Defaults to true. Errors stay until dismissed. */
dismissible?: boolean;
/** Only used for settled items. Pauses on hover and focus. */
autoDismissMs?: number;
};
export type QuietStatusStackProps = {
items: StatusItem[];
onDismiss?: (id: string) => void;
/** How many rows remain visible at once. */
max?: number;
label?: string;
className?: string;
};
function Icon({ tone }: { tone: StatusTone }) {
if (tone === "success") {
return (
<svg viewBox="0 0 18 18" aria-hidden="true" focusable="false">
<path
d="M3.5 9.5l3.4 3.2 7.6-8"
fill="none"
stroke="currentColor"
strokeWidth="1.7"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
);
}
if (tone === "error") {
return (
<svg viewBox="0 0 18 18" aria-hidden="true" focusable="false">
<path
d="M9 3.2v7.1"
fill="none"
stroke="currentColor"
strokeWidth="1.8"
strokeLinecap="round"
/>
<circle cx="9" cy="14" r="1" fill="currentColor" />
</svg>
);
}
if (tone === "processing") {
return (
<svg
className="qs-spinner"
viewBox="0 0 18 18"
aria-hidden="true"
focusable="false"
>
<circle
cx="9"
cy="9"
r="6.4"
fill="none"
stroke="currentColor"
strokeWidth="1.5"
strokeOpacity="0.24"
/>
<path
d="M9 2.6a6.4 6.4 0 0 1 6.4 6.4"
fill="none"
stroke="currentColor"
strokeWidth="1.5"
strokeLinecap="round"
/>
</svg>
);
}
return (
<svg viewBox="0 0 18 18" aria-hidden="true" focusable="false">
<circle cx="9" cy="9" r="3.1" fill="currentColor" opacity="0.55" />
</svg>
);
}
function StatusRow({
item,
onDismiss,
register,
}: {
item: StatusItem;
onDismiss?: (id: string) => void;
register: (id: string, node: HTMLElement | null) => void;
}) {
const rowRef = useRef<HTMLElement>(null);
const [leaving, setLeaving] = useState(false);
const [paused, setPaused] = useState(false);
const remaining = useRef<number | null>(null);
const started = useRef<number>(0);
const timer = useRef<number | null>(null);
const leaveTimer = useRef<number | null>(null);
const dismissing = useRef(false);
const auto = Boolean(item.autoDismissMs && item.status === "success");
const canDismiss = item.dismissible !== false;
const dismiss = (delay = true) => {
if (dismissing.current) return;
dismissing.current = true;
if (!delay) {
onDismiss?.(item.id);
return;
}
setLeaving(true);
leaveTimer.current = window.setTimeout(
() => onDismiss?.(item.id),
180,
);
};
/* Auto-dismiss is deadline-based so hover/focus pauses preserve the rest. */
useEffect(() => {
if (!auto || paused) {
if (timer.current !== null) {
window.clearTimeout(timer.current);
timer.current = null;
}
if (remaining.current !== null && started.current) {
remaining.current = Math.max(
0,
remaining.current - (Date.now() - started.current),
);
}
return;
}
if (remaining.current === null)
remaining.current = item.autoDismissMs ?? 0;
if (remaining.current <= 0) return;
started.current = Date.now();
timer.current = window.setTimeout(() => {
timer.current = null;
dismiss();
}, remaining.current);
return () => {
if (timer.current !== null) {
window.clearTimeout(timer.current);
timer.current = null;
}
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [auto, paused, item.autoDismissMs, item.id]);
useEffect(() => {
const onVisibility = () => setPaused(document.hidden);
document.addEventListener("visibilitychange", onVisibility);
return () => document.removeEventListener("visibilitychange", onVisibility);
}, []);
useEffect(
() => () => {
if (timer.current !== null) window.clearTimeout(timer.current);
if (leaveTimer.current !== null) window.clearTimeout(leaveTimer.current);
},
[],
);
const progress =
typeof item.progress === "number"
? Math.max(0, Math.min(1, item.progress))
: null;
return (
<li
ref={(node) => {
rowRef.current = node;
register(item.id, node);
}}
className="qs-item"
data-tone={item.status}
data-leaving={leaving ? "true" : "false"}
onPointerEnter={() => setPaused(true)}
onPointerLeave={() => setPaused(false)}
onFocusCapture={() => setPaused(true)}
onBlurCapture={(event) => {
if (!event.currentTarget.contains(event.relatedTarget as Node)) {
setPaused(false);
}
}}
>
<span className="qs-icon" aria-hidden="true">
<Icon tone={item.status} />
</span>
<div className="qs-copy">
<p className="qs-title">{item.title}</p>
{item.detail ? <p className="qs-detail">{item.detail}</p> : null}
{item.status === "processing" ? (
<div
className="qs-progress"
role="progressbar"
aria-label={`${item.title} progress`}
aria-valuemin={0}
aria-valuemax={100}
aria-valuenow={
progress === null ? undefined : Math.round(progress * 100)
}
data-indeterminate={progress === null ? "true" : "false"}
>
<span
style={
progress === null
? undefined
: { transform: `scaleX(${progress})` }
}
/>
</div>
) : null}
</div>
<div className="qs-actions">
{item.action ? (
<button
type="button"
className="qs-action"
onClick={item.action.onClick}
disabled={item.action.busy}
>
{item.action.busy ? "Working…" : item.action.label}
</button>
) : null}
{canDismiss ? (
<button
type="button"
className="qs-dismiss"
aria-label={`Dismiss ${item.title}`}
onClick={() => dismiss()}
>
<svg viewBox="0 0 16 16" aria-hidden="true" focusable="false">
<path
d="M4 4l8 8M12 4l-8 8"
fill="none"
stroke="currentColor"
strokeWidth="1.4"
strokeLinecap="round"
/>
</svg>
</button>
) : null}
</div>
</li>
);
}
/**
* QUIET STATUS STACK
*
* A low-volume activity log for work that continues in the background.
* Rows move with a small FLIP pass when one is added or removed, while
* the new row enters on top of that movement. Success can auto-dismiss
* and pauses on hover or focus; errors wait for a person. A single
* polite live region announces state changes, never progress frames.
*/
export function QuietStatusStack({
items,
onDismiss,
max = 4,
label = "Background activity",
className,
}: QuietStatusStackProps) {
const visible = items.slice(0, Math.max(1, max));
const nodes = useRef(new Map<string, HTMLElement>());
const boxes = useRef(new Map<string, DOMRect>());
const previous = useRef<string[]>([]);
const live = useRef<HTMLParagraphElement>(null);
const tones = useRef(new Map<string, StatusTone>());
const register = (id: string, node: HTMLElement | null) => {
if (node) nodes.current.set(id, node);
else nodes.current.delete(id);
};
useLayoutEffect(() => {
if (window.matchMedia?.("(prefers-reduced-motion: reduce)").matches) return;
const next = new Map<string, DOMRect>();
for (const item of visible) {
const node = nodes.current.get(item.id);
if (!node) continue;
next.set(item.id, node.getBoundingClientRect());
}
if (previous.current.length) {
let index = 0;
for (const item of visible) {
const node = nodes.current.get(item.id);
const before = boxes.current.get(item.id);
if (!node || !before) {
index += 1;
continue;
}
const after = next.get(item.id);
if (after && Math.abs(before.top - after.top) > 0.5) {
node.animate(
[
{ transform: `translateY(${before.top - after.top}px)` },
{ transform: "translateY(0)" },
],
{
duration: 260,
easing: "cubic-bezier(0.22, 1, 0.36, 1)",
delay: index < previous.current.length ? 0 : 30,
},
);
}
index += 1;
}
for (const item of visible) {
if (!previous.current.includes(item.id) && nodes.current.get(item.id)) {
nodes.current.get(item.id)!.animate(
[
{ opacity: 0, transform: "translateY(-5px) scale(0.99)" },
{ opacity: 1, transform: "translateY(0) scale(1)" },
],
{ duration: 240, easing: "cubic-bezier(0.22, 1, 0.36, 1)" },
);
}
}
}
boxes.current = next;
previous.current = visible.map((item) => item.id);
/* Announce transitions, not progress ticks. */
let message = "";
for (const item of visible) {
const tone = tones.current.get(item.id);
if (tone !== item.status) {
tones.current.set(item.id, item.status);
if (item.status === "success") message = `${item.title} finished.`;
else if (item.status === "error")
message = `${item.title} needs attention.`;
else if (!tone && item.status === "processing")
message = `${item.title} started.`;
}
}
if (message && live.current) {
live.current.textContent =
live.current.textContent === message ? `${message}\u200B` : message;
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [visible.map((item) => `${item.id}:${item.status}`).join("|")]);
return (
<div className={`qs-root${className ? ` ${className}` : ""}`}>
<p ref={live} className="qs-live" aria-live="polite" aria-atomic="true" />
<ul className="qs-list" aria-label={label}>
{visible.map((item) => (
<StatusRow
key={item.id}
item={item}
onDismiss={onDismiss}
register={register}
/>
))}
</ul>
</div>
);
}components/lab/quiet-status-stack/quiet-status-stack.css— press enter to show or hide the source
.qs-root {
--qs-ink: #1d2422;
--qs-muted: #66706c;
--qs-line: rgba(29, 36, 34, 0.12);
--qs-surface: #ffffff;
--qs-soft: #f5f6f4;
--qs-ok: #1d6b4c;
--qs-warn: #9a4b1c;
--qs-danger: #a12f2a;
--qs-focus: #1d2422;
--qs-ease: cubic-bezier(0.22, 1, 0.36, 1);
width: min(380px, 100%);
color: var(--qs-ink);
font: inherit;
}
.qs-live {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0 0 0 0);
white-space: nowrap;
border: 0;
}
.qs-list {
display: flex;
flex-direction: column;
gap: 8px;
margin: 0;
padding: 0;
list-style: none;
}
.qs-item {
position: relative;
display: flex;
align-items: flex-start;
gap: 11px;
padding: 12px 12px 12px 13px;
border: 1px solid var(--qs-line);
border-radius: 11px;
background: var(--qs-surface);
box-shadow:
0 1px 2px rgba(29, 36, 34, 0.04),
0 10px 26px -22px rgba(29, 36, 34, 0.32);
transition:
opacity 180ms ease,
transform 180ms ease,
border-color 180ms ease;
}
.qs-item[data-leaving="true"] {
opacity: 0;
transform: translateX(8px);
pointer-events: none;
}
.qs-item[data-tone="error"] {
border-color: color-mix(in srgb, var(--qs-danger) 34%, var(--qs-line));
background: color-mix(in srgb, var(--qs-danger) 3%, var(--qs-surface));
}
.qs-icon {
flex: none;
display: grid;
place-items: center;
width: 24px;
height: 24px;
margin-top: 1px;
border-radius: 50%;
background: var(--qs-soft);
color: var(--qs-muted);
}
.qs-item[data-tone="success"] .qs-icon {
color: var(--qs-ok);
background: color-mix(in srgb, var(--qs-ok) 10%, transparent);
}
.qs-item[data-tone="error"] .qs-icon {
color: var(--qs-danger);
background: color-mix(in srgb, var(--qs-danger) 10%, transparent);
}
.qs-item[data-tone="processing"] .qs-icon {
color: var(--qs-warn);
background: color-mix(in srgb, var(--qs-warn) 9%, transparent);
}
.qs-icon svg {
width: 16px;
height: 16px;
}
.qs-spinner {
animation: qs-spin 1.2s linear infinite;
}
.qs-copy {
flex: 1;
min-width: 0;
padding-top: 1px;
}
.qs-title {
margin: 0;
font-size: 0.8125rem;
font-weight: 600;
letter-spacing: -0.005em;
line-height: 1.35;
overflow-wrap: anywhere;
}
.qs-detail {
margin: 2px 0 0;
color: var(--qs-muted);
font-size: 0.75rem;
line-height: 1.42;
overflow-wrap: anywhere;
}
.qs-progress {
position: relative;
height: 3px;
margin-top: 8px;
overflow: hidden;
border-radius: 999px;
background: rgba(29, 36, 34, 0.1);
}
.qs-progress > span {
display: block;
width: 100%;
height: 100%;
border-radius: inherit;
background: var(--qs-warn);
transform-origin: left center;
transition: transform 320ms linear;
}
.qs-progress[data-indeterminate="true"] > span {
width: 38%;
animation: qs-indeterminate 1.4s var(--qs-ease) infinite;
}
.qs-actions {
flex: none;
display: flex;
align-items: center;
gap: 5px;
margin-top: -2px;
}
.qs-action {
min-height: 28px;
padding: 4px 8px;
border: 1px solid var(--qs-line);
border-radius: 6px;
background: var(--qs-surface);
color: var(--qs-ink);
font: inherit;
font-size: 0.6875rem;
font-weight: 600;
cursor: pointer;
transition:
background-color 140ms ease,
border-color 140ms ease;
}
.qs-action:hover {
background: var(--qs-soft);
border-color: rgba(29, 36, 34, 0.2);
}
.qs-action:disabled {
opacity: 0.5;
cursor: wait;
}
.qs-dismiss {
display: grid;
place-items: center;
width: 26px;
height: 26px;
border: 0;
border-radius: 6px;
background: transparent;
color: var(--qs-muted);
cursor: pointer;
transition:
color 140ms ease,
background-color 140ms ease;
}
.qs-dismiss:hover {
color: var(--qs-ink);
background: var(--qs-soft);
}
.qs-action:focus-visible,
.qs-dismiss:focus-visible {
outline: 2px solid var(--qs-focus);
outline-offset: 1px;
}
.qs-dismiss svg {
width: 13px;
height: 13px;
}
@keyframes qs-spin {
to {
transform: rotate(360deg);
}
}
@keyframes qs-indeterminate {
0% {
transform: translateX(-105%);
}
100% {
transform: translateX(275%);
}
}
@media (max-width: 420px) {
.qs-item {
flex-wrap: wrap;
}
.qs-copy {
flex-basis: calc(100% - 38px);
}
.qs-actions {
margin-left: 35px;
}
}
@media (prefers-reduced-motion: reduce) {
.qs-item {
transition-duration: 0.01ms;
}
.qs-spinner {
animation: none;
}
.qs-progress[data-indeterminate="true"] > span {
width: 42%;
animation: none;
}
}