MeDo

Generador de Toast con IA.

Describe el comportamiento de tus notificaciones y MeDo genera el sistema de toast completo — cuatro tipos semánticos, una cola de apilado, temporizadores de cierre automático que se pausan al pasar el cursor, cierre por deslizamiento táctil y la cortesía aria-live correcta para cada tipo.

Toast
Toast

Un toast es un temporizador, una cola y una live region disfrazados de caja

La parte visual de un toast lleva minutos. Todo lo que hay debajo, no. Un toast tiene que decidir cuánto tiempo permanece, qué ocurre cuando llegan tres a la vez, qué ocurre cuando el usuario está a mitad de una frase en un formulario y cómo lo escucha un lector de pantalla sin ser interrumpido. La consecuencia menos obvia es que los errores de toast se manifiestan como errores de confianza: una confirmación de guardado que desaparece antes de leerse, o un error que se esfuma mientras el usuario está leyendo el campo al que se refiere, enseña a la gente a no creer en la interfaz. Generar juntas las reglas de tiempo, los límites de cola y la cortesía de la live region mantiene esas decisiones coherentes en lugar de dispersas por cada punto de llamada que lanzó la notificación.

6 plantillas

Plantillas de Toast que puedes generar

Cada plantilla es un prompt real, no una captura de pantalla. Cópialo en cualquier editor de IA o ejecútalo en MeDo y obtén código React + Tailwind.

BasicFour Tones

Success, Error, Warning, Info Stack

The baseline set, and the only one where per-type rules matter more than styling. Errors that auto-dismiss are the single most common toast bug in production.

Create a toast system with four semantic types — success with a check icon and green accent, error with an alert icon and red accent, warning with a triangle and amber accent, info with a circle and blue accent. Each toast is 360px wide with a 12px radius, 16px padding, a semibold title, an optional description and a close button with an accessible label. Stack in the bottom-right with 8px gaps, newest on top, three visible at once and the rest queued. Auto-dismiss success, info and warning after 5000ms; keep errors until the user closes them. Wrap non-error toasts in role="status" with aria-live="polite" and give errors role="alert". Slide in 16px from the right and fade out; under prefers-reduced-motion, fade only.

Prueba en MeDo
TimingPausable Timer

Countdown Bar That Freezes on Hover

A visible progress bar plus a timer that stops while the pointer or keyboard focus is on the toast. Without the pause, a toast can vanish while the user is reaching for its own action button.

Create a toast with a visible dismiss countdown: a 2px progress bar along the bottom edge animating from full to zero over the toast duration. Pause the timer and freeze the bar on pointerenter and on focusin anywhere inside the toast, then resume from the remaining time on pointerleave and focusout — track elapsed time explicitly rather than restarting the interval, or the toast will live longer every time the pointer crosses it. Reset to the full duration when the toast content is updated in place. Under prefers-reduced-motion, replace the animated bar with a static severity stripe and keep the timer behaviour unchanged. Keep the toast in a role="status" region with aria-live="polite".

Prueba en MeDo
UndoAction Toast

Toast With an Undo or Retry Action

The moment a toast carries a button, it stops being decoration and becomes the only route to a reversible operation — so it must not auto-dismiss while the action is still valid.

Create a toast variant with a single inline action button — Undo or Retry — beside the close control. Do not auto-dismiss while an action is present unless the caller passes an explicit duration, and never dismiss on a timer shorter than the window in which the action is still valid server-side. Move keyboard focus nowhere on mount; instead expose the toast region via a landmark and make the action reachable through a documented shortcut plus normal tab order, so a toast never steals focus from a form the user is typing in. Announce the toast with role="status" and aria-live="polite", and include the action label in the announced text so the option is heard, not just seen.

Prueba en MeDo
AsyncPromise Toast

One Toast That Updates in Place

Pending, then success or error, on the same node. Firing a second toast when a request resolves stacks two notifications about one event and doubles the screen reader announcement.

Create a promise-driven toast that mounts in a pending state with a spinner and a loading title, then updates the same toast node to success or error when the promise settles rather than mounting a second toast. Keep the toast ID stable across the transition so the stack position does not change, swap the icon and accent, and start the auto-dismiss timer only once the promise resolves. On rejection, switch the container to role="alert" and cancel auto-dismiss. Because the live region content changes in place, debounce the announcement so a request that resolves in under 400ms announces the final state only. Cap the pending state with a timeout that converts to an error toast rather than spinning forever.

Prueba en MeDo
MobileSwipe Toast

Top-Center Toast With Swipe Dismiss

On a phone the bottom corner is under the thumb and the home indicator. Top-center with a horizontal drag threshold is the only placement that does not fight the platform.

Create a mobile-first toast pinned to the top-center with a safe-area inset using env(safe-area-inset-top), full width minus 16px gutters, capped at a single line of title text with the description truncated to two lines. Add horizontal swipe-to-dismiss with a 60px or 40% drag threshold, translating with the pointer and springing back below the threshold; suppress the pointer handlers while the user is scrolling the page underneath. Keep the close button hit area at 44px even though the glyph is 16px. Show one toast at a time and replace rather than stack, since a stack on a 375px viewport covers the content. Use role="status" with aria-live="polite" and disable the spring under prefers-reduced-motion.

Prueba en MeDo
SnackbarCompact Snackbar

Single-Line Bar With No Icon

One line, no title, no icon — for low-stakes confirmations like "Link copied" where a 360px card with an icon block is more furniture than the message deserves.

Create a compact snackbar toast: a single line of 14px text on a dark surface, 8px radius, 12px vertical and 16px horizontal padding, no icon and no separate title, with an optional text-only action on the right. Anchor it bottom-center with a 24px offset and allow only one at a time — a new snackbar replaces the current one and resets its 4000ms timer instead of queueing, because these fire from rapid interactions like copy and toggle. Announce via role="status" with aria-live="polite", and when the text is identical to the previous message, force re-announcement by clearing the live region for one frame. Fade and lift 8px on entry; fade only under prefers-reduced-motion.

Prueba en MeDo

Cómo personalizar tu Toast

Dale a los errores reglas distintas de todo lo demás

Pide cierre automático para success, info y warning, y que los errores persistan hasta que se cierren. Los errores suelen requerir que el usuario haga algo, y un mensaje que se elimina antes de comprenderse es peor que ningún mensaje.

Fija un límite de apilado y define qué hace el desborde

Especifica cuántos toasts pueden estar visibles a la vez — tres es un techo razonable — y si los extras se encolan detrás o reemplazan al más antiguo. Sin límite, un bucle que lanza una notificación por elemento empapelará todo el viewport.

Pide que el temporizador se pause al pasar el cursor y al recibir foco

Solicita en el prompt que la cuenta atrás se congele mientras el puntero está sobre el toast o un control dentro de él tiene el foco de teclado. De lo contrario, un toast puede desaparecer mientras el usuario alarga la mano hacia su propio botón de acción.

Nombra la esquina y el área segura

Elige una ubicación y descríbela: la inferior derecha queda lejos de la mayoría de las navegaciones principales, la superior centrada se lee más rápido. En móvil, pide padding con env(safe-area-inset-bottom) para que los toasts no caigan bajo el indicador de inicio o una barra de pestañas fija.

Quién usa el componente Toast

Producto SaaS

Toasts de éxito breves que confirman guardados automáticos e invitaciones, con toasts de error persistentes que llevan una acción "Reintentar" cuando falla una sincronización en segundo plano. La posición inferior derecha los mantiene alejados de la barra lateral de la app.

Tienda de comercio electrónico

Un toast de "Añadido al carrito" con miniatura y un enlace "Ver carrito", que se cierra tras cinco segundos. Los fallos de stock y de pago usan el tipo error y permanecen para que el comprador pueda leer qué salió mal.

Dashboard o herramienta de administración

Las operaciones masivas emiten un único toast de resumen en lugar de uno por registro, y los procesos largos actualizan un solo toast en el sitio de pendiente a éxito en vez de apilar una segunda notificación encima.

Aplicación web móvil

Toasts centrados arriba con cierre por deslizamiento y safe-area insets, dimensionados a una sola línea para que nunca cubran el campo en el que el usuario está escribiendo.

Patrones de Toast para distintos sitios web

El mismo componente toast, adaptado al tipo de sitio donde se publica.

01 / 06

SaaS Product Toasts

Autosave confirmations and invite receipts, bottom-right so they clear the sidebar. The rule that matters most here is that background-sync failures get persistent error toasts with a Retry action — a sync error that dismisses itself is indistinguishable from a sync that worked.

Estilos y variantes de Toast

Elige la variante que encaje con el resto de la página y genérala.

01 / 06

Card Toast With Icon and Accent

The full anatomy: icon, semibold title, description, close button, colored accent. Worth the vertical space when the message has a subject and a detail. It is overkill for "Copied" — use the snackbar for those.

Toast en React, Next.js, Vue y Svelte

React, Next.js, Vue 3, SvelteKit, Astro o HTML puro: el mismo toast, seis formas de integrarlo.

01 / 06

React Toast

A context provider holding the queue plus a portal for the container. Mount the provider once above the router so navigating between routes does not unmount the toast that was just fired.

src/components/ToastProvider.tsx

export function ToastProvider({ children }) {
  const [toasts, setToasts] = useState([])
  const push = (t) => setToasts((prev) => [...prev, { id: uid(), ...t }])

  return (
    <ToastContext.Provider value={{ push }}>
      {children}
      {createPortal(<ToastStack toasts={toasts} />, document.body)}
    </ToastContext.Provider>
  )
}

Cómo añadir tu Toast a un proyecto

Cuatro pasos, desde elegir una plantilla de toast hasta llevarlo a producción.

01~30s

Pick a Toast Pattern

Choose by the event, not the look: the four-tone stack for general notifications, the promise toast for async jobs, the action toast for anything reversible, the swipe variant for phone-first surfaces.

02~10s

Copy the Prompt

Take it into MeDo, Lovable, Bolt, v0 or Cursor. Set the duration and the stack limit before you run it, and decide there whether errors auto-dismiss — that is the decision you will otherwise relitigate at every call site.

03~1min

Generate and Refine

You get the provider, the queue and the toast back with a live preview. Follow up in plain English — "pause the timer on hover", "move it to top-center on mobile", "cap the stack at two" — instead of hand-editing timer logic.

04~2min

Mount the Provider Once

Put it above the router in your root layout so a toast fired just before a navigation survives it, then fire one from a real form submit and confirm a screen reader announces it without cutting off the page.

Preguntas frecuentes sobre Toast

¿Cómo genero un componente de notificación toast con IA?

Describe los tipos semánticos, la ubicación y los tiempos en un solo prompt — por ejemplo "toasts de success, error, warning e info apilados abajo a la derecha, cierre automático a los 5 segundos excepto los errores" — y MeDo genera el provider, la cola y el propio toast. Obtienes la función que lo dispara junto al markup, no una caja estática que aún tienes que conectar.

¿Cuánto tiempo debe permanecer un toast en pantalla?

De cuatro a seis segundos funciona para una confirmación breve, y 5000ms es un valor predeterminado sensato. Los mensajes más largos necesitan más tiempo porque la velocidad de lectura, no la estética, marca el mínimo. Los errores y todo lo que lleve un botón de acción no deberían cerrarse automáticamente.

¿Cuál es la diferencia entre un alert y un toast?

Un toast es transitorio y flota sobre la página en una esquina fija, así que sirve para confirmar algo que el usuario acaba de hacer. Un alert en línea forma parte del flujo del documento y persiste hasta que cambia la condición, así que sirve para estados que sobreviven a una única acción: un método de pago fallido, una ventana de mantenimiento, un error a nivel de formulario. Si el usuario necesita poder volver y leerlo, usa un alert.

¿Un toast debe usar role="status" o role="alert"?

Usa role="status" con aria-live="polite" para los toasts de éxito e informativos, de modo que el anuncio espere una pausa en el habla. Reserva role="alert", que es implícitamente asertivo e interrumpe, para errores y advertencias que requieren atención inmediata. Marcar todos los toasts como alert hace que el lector de pantalla hable constantemente por encima del usuario.

¿Puedo apilar varios toasts sin que se solapen?

Sí. Pide a MeDo un contenedor de toasts que renderice una pila limitada con separación fija y encole todo lo que exceda el límite, liberando el siguiente elemento a medida que uno se cierra. Añadir una transición de salida y reservar la altura del elemento que se va hasta que termine la animación evita que los toasts restantes salten.

¿Funciona un toast en dispositivos táctiles?

Funciona si pides soporte de gestos. Especifica cierre por deslizamiento horizontal con un umbral de arrastre, mantén el botón de cerrar con al menos 44px de área táctil y añade padding de safe-area inset para que el toast libre el indicador de inicio y cualquier barra inferior fija.