Rendimiento
Requiere atenciónFrecuencia de fotogramas: 60 fps de media, p5 59.5 · Tareas largas: 0 tareas, 0 ms en total, la más larga 0 ms · Código gzip 6.2 KB · En ejecución 276 KB
Toast stackMITNotificaciónBencho
Componente React de Notificación de Lorenzo Cabra. Recopilado sin cambios de Bencho bajo la licencia MIT y mostrado aquí en directo.
Informe de calidad
La nota y la puntuación proceden de comprobaciones automáticas hechas en la compilación o en las pruebas. Si una comprobación no se ejecutó, se marca Como no comprobada: nunca se inventan cifras.
Frecuencia de fotogramas: 60 fps de media, p5 59.5 · Tareas largas: 0 tareas, 0 ms en total, la más larga 0 ms · Código gzip 6.2 KB · En ejecución 276 KB
Problemas 1 · Lector de pantalla: Correcto
Sin movimiento continuo
Sin desbordamiento
La frecuencia de fotogramas y las tareas largas se midieron en Chromium sin interfaz, con WebGL por software. Solo son comparables entre componentes de este sitio y no representan un dispositivo real.
No aplica: no hay animación visible en reposo. Las animaciones que se activan al pasar el cursor no se probaron.

Comprobado el 15 nov 2026 · Las cifras salen de un script automatico, no de ejemplos escritos a mano.
Se muestra a tamaño real.
La copia empieza con el aviso de licencia. Consérvalo al usar el código.
<div id="root"></div>:root{--bg:#f6f4f0;--ink:#17181a;--background:40 20% 96%;--foreground:24 10% 8%;--card:0 0% 100%}html,body{min-height:100%;margin:0;background:var(--bg);color:var(--ink)}html,body{height:100%;overflow:hidden}body{display:grid;place-items:center}#root{display:grid;place-items:center;max-width:100%;max-height:100%;box-sizing:border-box;padding:16px;color:hsl(var(--foreground))}#root.full{width:100%;height:100%;padding:0}@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation-play-state:paused!important;transition-duration:0s!important}}
/*
MIT License
Copyright (c) 2026 Lorenzo Cabra
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
---
Not covered by this licence: the Bencho name and the goat mark, and the
photographs shown on bencho.dev (none are included here). Third-party
material keeps its own licence; see THIRD_PARTY.md.
Icon substitution (this copy only): lucide-react (ISC) was replaced with @tabler/icons-react (MIT).
Sample photographs were replaced with Incidental AI assets. The Bencho name and goat mark are not licensed for marketing use.
*/
/* ── Bencho tokens ─────────────────────────────────────────
The custom properties the free blocks read, at the values
bencho.dev draws them with. Light by default; dark under
[data-theme="dark"] on any ancestor, or automatically with
the system setting unless [data-theme="light"] says otherwise.
Map these to your own theme rather than keeping two: a block
only ever reads the names, never the values. */
:root {
--font-ui: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
--bg: #ffffff;
--board: #ffffff;
--card: #f7f7f6;
--surface: #f7f7f6;
--surface-2: #f1f1f0;
--surface-3: #ecebe7;
--ink: #17181a;
--ink-rgb: 23, 24, 26;
--ink-2: #3c3b37;
--ink-3: #5c5b56;
--ink-4: #6f6e68;
--ink-5: #85847e;
--on-ink: #ffffff;
--on-ink-rgb: 255, 255, 255;
--slab: #17181a;
--on-slab: #ffffff;
--slab-dark: #0e0f11;
--fill-slab: #ffffff;
--fill-on: #17181a;
--fill-on-rgb: 23, 24, 26;
--pane: var(--fill-slab);
--pane-edge: rgba(23, 24, 26, 0.08);
--pane-thumb: rgba(23, 24, 26, 0.07);
--inlay: rgba(255, 255, 255, 0.55);
--inlay-hi: rgba(23, 24, 26, 0.09);
--elev-rgb: 255, 255, 255;
--glass-rgb: 255, 255, 255;
--shadow-rgb: 23, 24, 26;
--wash: 0.06;
--pick: #0d99ff;
--signal: #2231dd;
--focus: #2231dd;
--ok: #15803d;
--ember: #b8431c;
color-scheme: light;
}
[data-theme="dark"] {
--bg: #000000;
--board: #1a1a1a;
--card: #0a0a0a;
--surface: #0f0f0f;
--surface-2: #181818;
--surface-3: #202020;
--ink: #ffffff;
--ink-rgb: 255, 255, 255;
--ink-2: #b4b4b4;
--ink-3: #9a9a9a;
--ink-4: #828282;
--ink-5: #6b6b6b;
--on-ink: #000000;
--on-ink-rgb: 0, 0, 0;
--slab: #1a1a1a;
--on-slab: #ffffff;
--slab-dark: #262626;
--fill-slab: #262626;
--fill-on: #ffffff;
--fill-on-rgb: 255, 255, 255;
--pane-edge: rgba(255, 255, 255, 0.08);
--pane-thumb: rgba(255, 255, 255, 0.07);
--inlay: rgba(255, 255, 255, 0.1);
--inlay-hi: rgba(255, 255, 255, 0.09);
--elev-rgb: 32, 32, 32;
--shadow-rgb: 0, 0, 0;
--wash: 0.09;
--pick: #3aa9ff;
--ok: #34d17a;
color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
--bg: #000000;
--board: #1a1a1a;
--card: #0a0a0a;
--surface: #0f0f0f;
--surface-2: #181818;
--surface-3: #202020;
--ink: #ffffff;
--ink-rgb: 255, 255, 255;
--ink-2: #b4b4b4;
--ink-3: #9a9a9a;
--ink-4: #828282;
--ink-5: #6b6b6b;
--on-ink: #000000;
--on-ink-rgb: 0, 0, 0;
--slab: #1a1a1a;
--on-slab: #ffffff;
--slab-dark: #262626;
--fill-slab: #262626;
--fill-on: #ffffff;
--fill-on-rgb: 255, 255, 255;
--pane-edge: rgba(255, 255, 255, 0.08);
--pane-thumb: rgba(255, 255, 255, 0.07);
--inlay: rgba(255, 255, 255, 0.1);
--inlay-hi: rgba(255, 255, 255, 0.09);
--elev-rgb: 32, 32, 32;
--shadow-rgb: 0, 0, 0;
--wash: 0.09;
--pick: #3aa9ff;
--ok: #34d17a;
color-scheme: dark;
}
}
/* ToastStack.css */
/*
MIT License
Copyright (c) 2026 Lorenzo Cabra
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
---
Not covered by this licence: the Bencho name and the goat mark, and the
photographs shown on bencho.dev (none are included here). Third-party
material keeps its own licence; see THIRD_PARTY.md.
Icon substitution (this copy only): lucide-react (ISC) was replaced with @tabler/icons-react (MIT).
Sample photographs were replaced with Incidental AI assets. The Bencho name and goat mark are not licensed for marketing use.
*/
/* ══ Toast stack (lab/ToastStack.tsx) ══════════════════════════
Three toasts stacked, fanning into a list on hover. Tones are the
reference's: the front one white, the tucked ones a barely-there
2% grey — both the same, so they read as paper behind paper rather
than a darkening ramp. Where the reference separates them with a
soft shadow, this uses a faint hairline (no drop shadows on the
bench). Status icons are their own solid colours, never faded. */
.tst {
position: relative;
font-family: var(--font-ui);
color: var(--fill-on, var(--ink));
--tst-mute: color-mix(in srgb, var(--fill-on, #17181a) 52%, var(--fill-slab, #ffffff));
--tst-wash: color-mix(in srgb, var(--fill-on, #17181a) 6%, var(--fill-slab, #ffffff));}
.tst-toast {
position: absolute;
left: 0;
top: 0;
width: 100%;
box-sizing: border-box;
display: flex;
align-items: center;
gap: 12px;
padding: 0 12px 0 16px;
border-radius: var(--tst-r);
background: var(--fill-slab, #ffffff);
transform-origin: 50% 0;
transition: background-color 220ms ease, box-shadow 220ms ease;}
/* tucked: the same near-white for both, and a faint edge so each
sliver has a line to read by */
.tst:not([data-open]) .tst-toast:not([data-front]) {
background: color-mix(in srgb, var(--fill-on, #17181a) 6%, var(--fill-slab, #ffffff));
box-shadow: 0 0 0 1px color-mix(in srgb, var(--fill-on, #17181a) 6%, transparent);}
[data-stroke="on"] .tst-toast { box-shadow: 0 0 0 1px var(--pane-edge); }
/* only the front one is read while stacked; the rest are slivers */
.tst-toast > * { transition: opacity 220ms ease; }
.tst:not([data-open]) .tst-toast:not([data-front]) > * { opacity: 0; }
.tst-icon { flex: none; display: grid; place-items: center; }
.tst-toast[data-kind="success"] .tst-icon { color: #1f9d55; }
.tst-toast[data-kind="error"] .tst-icon { color: #e5484d; }
.tst-toast[data-kind="warning"] .tst-icon { color: #e09a12; }
.tst-toast[data-kind="info"] .tst-icon { color: var(--tst-mute); }
.tst-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tst-text b { font-size: 14px; font-weight: 500; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.01em; }
.tst-text span { font-size: 13px; line-height: 17px; color: var(--tst-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0em; }
.tst-act {
flex: none;
height: 28px;
padding: 0 12px;
border: 0;
border-radius: 999px;
background: var(--tst-wash);
color: inherit;
font: inherit;
font-size: 13px;
font-weight: 500;
cursor: pointer;
transition: scale 160ms cubic-bezier(0.22, 1, 0.36, 1);
letter-spacing: 0em;}
.tst-act:active { scale: 0.96; }
.tst-x {
flex: none;
width: 28px;
height: 28px;
display: grid;
place-items: center;
border: 0;
border-radius: 999px;
background: none;
color: var(--tst-mute);
cursor: pointer;
transition: background-color 160ms ease, color 160ms ease;}
.tst-x:hover { background: var(--tst-wash); color: var(--fill-on, var(--ink)); }
.tst-act:focus-visible, .tst-x:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--signal, #2231dd); }
// bencho source (MIT). npm i @tabler/icons-react motion react · Tailwind CSS v4
// ── blocks/toast-stack/ToastStack.tsx (https://github.com/cabralorenzo/bencho/blob/c65992417427bb09e661674ffa800bef29adef49/blocks/toast-stack/ToastStack.tsx)
/*
MIT License
Copyright (c) 2026 Lorenzo Cabra
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
---
Not covered by this licence: the Bencho name and the goat mark, and the
photographs shown on bencho.dev (none are included here). Third-party
material keeps its own licence; see THIRD_PARTY.md.
Icon substitution (this copy only): lucide-react (ISC) was replaced with @tabler/icons-react (MIT).
Sample photographs were replaced with Incidental AI assets. The Bencho name and goat mark are not licensed for marketing use.
*/
import { type CSSProperties, useRef, useState } from "react";
import { motion } from "motion/react";
import { IconCircleCheck as CircleCheck, IconCircleX as CircleX, IconInfoCircle as Info, IconAlertTriangle as TriangleAlert, IconX as X } from "@tabler/icons-react";
/* ══ Toast stack ══════════════════════════════════════════
Three toasts, always: the newest in front, the two before it
tucked behind with a sliver of each showing above it, a step
smaller each and a barely-there grey (the reference's tones). Point at the stack and it
fans out into a list; move away and it gathers back up.
── ONE SPRING, THREE PLACES ────────────────────────────
A toast's place is worked out from how far back it is and
whether the stack is open, and Framer springs it there. Opening,
closing, a toast leaving and the next arriving are all the same
move — every toast heading for its new place on the same spring,
a touch under critical so it settles with a hint of give.
── HOVER IS THE WHOLE FRAME ────────────────────────────
The stack opens about its middle, so the front toast moves when
it opens. Hovering the toasts themselves would let the list slide
out from under the pointer and close again; the frame is the
list's own size, so hovering it is hovering the list. Pointer
over/out with a containment test rather than enter/leave, so the
wall's demonstration — which dispatches its own pointer events,
and leaves with no relatedTarget — opens and closes it too (the
tilt card's note has the long version).
── IT NEVER RUNS OUT ───────────────────────────────────
Dismiss one and it slides away; a new one rises in at the front
from the pool, so there are always three. Retry on the failed
payment turns that toast into the payment going through, in
place. */
type Kind = "success" | "info" | "error" | "warning";
type Toast = { id: number; kind: Kind; title: string; body: string; action?: string };
const ICON: Record<Kind, LucideIcon> = {
success: CircleCheck,
info: Info,
error: CircleX,
warning: TriangleAlert,
};
const POOL: Omit<Toast, "id">[] = [
{ kind: "error", title: "Payment declined", body: "Try another card.", action: "Retry" },
{ kind: "info", title: "Kai joined your bench", body: "They can comment and copy." },
{ kind: "success", title: "brand-kit.zip uploaded", body: "Saved to Launch week." },
{ kind: "warning", title: "Storage is 92% full", body: "Exports pause at the limit." },
{ kind: "success", title: "Block saved", body: "Swipe deck is in Favourites." },
];
const W = 300;
const H = 64;
const SHOWN = 3;
/* a touch under critical: it settles with a hint of give, no wobble */
const SPRING = { type: "spring", stiffness: 380, damping: 34, mass: 1 } as const;
export function ToastStack({
peek = 14,
gap = 10,
corner = 20,
}: {
peek?: number;
gap?: number;
corner?: number;
}) {
/* front first; ids count up so a returning toast is a new element */
const next = useRef(SHOWN);
const [stack, setStack] = useState<Toast[]>(() =>
POOL.slice(0, SHOWN).map((t, i) => ({ ...t, id: i })),
);
const [leaving, setLeaving] = useState<number | null>(null);
const [open, setOpen] = useState(false);
const root = useRef<HTMLDivElement | null>(null);
/* the frame is the open list's size; both states sit in its middle */
const listH = SHOWN * H + (SHOWN - 1) * gap;
const stackH = H + (SHOWN - 1) * peek;
const FH = listH;
const place = (k: number) => {
if (open) {
/* the list: front at the bottom, the rest above it */
const top = (FH - listH) / 2;
return { y: top + (SHOWN - 1 - k) * (H + gap), scale: 1 };
}
/* the stack: front at the bottom, each one behind a peek higher
and a step smaller, hanging from its top edge */
const top = (FH - stackH) / 2;
const d = Math.min(k, SHOWN - 1);
return { y: top + (SHOWN - 1 - d) * peek, scale: 1 - d * 0.05 };
};
const dismiss = (id: number) => {
if (leaving !== null) return;
setLeaving(id);
window.setTimeout(() => {
setStack((s) => {
const rest = s.filter((t) => t.id !== id);
const n = next.current++;
const fresh = { ...POOL[n % POOL.length], id: n };
return [fresh, ...rest];
});
setLeaving(null);
}, 220);
};
const retry = (id: number) => {
setStack((s) => s.map((t) => (t.id === id
? { ...t, kind: "success", title: "Payment complete", body: "Your card was charged.", action: undefined }
: t)));
};
return (
<div
ref={root}
className="tst"
role="region"
aria-label="Notifications"
data-open={open || undefined}
style={{ width: W, height: FH, ["--tst-r" as string]: `${corner}px` } as CSSProperties}
onPointerOver={() => setOpen(true)}
onPointerOut={(e) => {
const to = e.relatedTarget as Node | null;
if (!to || !root.current?.contains(to)) setOpen(false);
}}
onFocus={() => setOpen(true)}
onBlur={(e) => { if (!root.current?.contains(e.relatedTarget as Node | null)) setOpen(false); }}
>
{stack.map((t, k) => {
const Icon = ICON[t.kind];
const out = leaving === t.id;
const p = place(k);
const front = k === 0;
return (
<motion.div
key={t.id}
className="tst-toast"
data-kind={t.kind}
data-front={front || undefined}
style={{ height: H, zIndex: SHOWN - k }}
/* a new one rises in from below the front */
initial={{ y: place(0).y + 24, scale: 1, opacity: 0, x: 0 }}
animate={out
? { y: p.y, scale: p.scale, opacity: 0, x: 60 }
: { y: p.y, scale: p.scale, opacity: 1, x: 0 }}
transition={out ? { duration: 0.22, ease: [0.4, 0, 1, 1] } : SPRING}
aria-hidden={!open && !front ? true : undefined}
>
<span className="tst-icon"><Icon size={18} strokeWidth={2} aria-hidden="true" /></span>
<span className="tst-text">
<b>{t.title}</b>
<span>{t.body}</span>
</span>
{t.action && (
<button type="button" className="tst-act" tabIndex={open || front ? 0 : -1} onClick={() => retry(t.id)}>
{t.action}
</button>
)}
<button
type="button"
className="tst-x"
aria-label={`Dismiss ${t.title}`}
tabIndex={open || front ? 0 : -1}
onClick={() => dismiss(t.id)}
>
<X size={16} strokeWidth={2} aria-hidden="true" />
</button>
</motion.div>
);
})}
</div>
);
}Controles · HTML · CSS · JS
Edita el código y ajústalo con los controles. La vista previa se actualiza mientras escribes.

Este componente se ejecuta desde un paquete compilado, así que su script es de solo lectura aquí. Edita el HTML y el CSS; el código completo está en la pestaña Código.
Edita cada componente en directo, ajústalo con controles, descarga el código completo y copia los prompts avanzados.
49 $ pago únicoPrecio provisional
Modo de prueba: no se cobra nada real.
Gratis: vista previa, botones de copiar y notas de la lección.
Un icono, una frase y un color claro cuentan qué ha pasado.
Avisos de guardado, errores, alertas y confirmaciones breves.
Cambia el color según el estado, el radio y la animación de entrada.
Añade el componente "Toast stack" de Bencho (github.com/cabralorenzo/bencho) (MIT) a mi aplicación React + Tailwind CSS. Archivo fuente: https://github.com/cabralorenzo/bencho/blob/c65992417427bb09e661674ffa800bef29adef49/blocks/toast-stack/ToastStack.tsx. Un icono, una frase y un color claro cuentan qué ha pasado. Úsalo para: Avisos de guardado, errores, alertas y confirmaciones breves. Ajustes que se pueden cambiar: Cambia el color según el estado, el radio y la animación de entrada. Admite temas claro y oscuro y respeta prefers-reduced-motion. Conserva el aviso de licencia MIT.
Un prompt más largo con pasos de ajuste, accesibilidad e integración.