Skip to content
IndexRequest a UIAboutContact

Undo Countdown Toast

Delete an item and an undo toast appears with a shrinking timer; hover or focus pauses it and Undo restores the item.

Open alone ↗

AI prompt

PROMPT: PASTE INTO YOUR AI CODING TOOL
Clean UI mockup of a list of three rows with a bottom-left toast notification that reads Conversation deleted with a bold Undo button and a thin white progress bar along the bottom edge shrinking from right to left, the toast dark charcoal with rounded corners and a soft shadow, one list row visibly missing, light theme, flat modern style. Negative: heavy shadows, clutter, text errors, device frames. Reduced motion: static design with a text countdown.

About this pattern

Definition

A better alternative to a confirm dialog is to do the action at once and offer a short Undo. The toast shows what happened, how long the undo window lasts with a shrinking bar, and pauses while the pointer or keyboard focus is on it so nobody loses the chance because they were reading.

Purpose & UX principles

  • Act immediately, then show Item deleted with an Undo button for 5 to 8 seconds.
  • Show the remaining time as a shrinking bar or ring.
  • Pause the timer on hover and focus; resume when they leave.
  • If another action happens, stack or replace the toast, and make deletion final only when the toast ends.

Interaction states

  • A list of three items; delete one and use Undo within the countdown.

Motion specification

  • The bar shrinks over 6 seconds.
  • Reduced motion: the bar is replaced by a text countdown.

Responsive behaviour

  • Announce the toast to screen readers with role status.
  • Make sure the window is long enough; people need time to notice.

Code

HTML
<div class="bx"><ul class="ls" id="ls"></ul><div class="to" id="to" role="status" hidden><span id="tt"></span><button class="mini" id="un" type="button">Undo</button><b class="tb"><i id="ti"></i></b></div><p class="out" id="out"></p></div>

Related patterns

Snackbar

↗
SnackbarFeedback & Notifications

Toast

↗
ToastFeedback & Notifications

Optimistic Update & Rollback

↗
Optimistic Update & RollbackLoading & Progress