yagnikbarasiya2306@gmail.com

Web · Toast stack

Deck

Toasts that stack, fan out and flick away.

A toast stack. New notifications land in front, older ones tuck behind, the stack fans out when you reach for it, and a toast flicks away with the speed of your swipe.

Platform
Any modern browser · any framework
Size
5.0 KB gzip
Dependencies
None
Licence
MIT · free for client work

Demo

A recording of the demo. Open it in a new tab

What it does

  1. 01

    Newest in front, older toasts tucked behind; hover or focus fans them out

  2. 02

    Swipe to dismiss uses release velocity, with rubber-banding the wrong way

  3. 03

    Success, error, action and promise toasts with a loading state

  4. 04

    Errors are alerts, the rest polite status; timers pause while you read

Use it

Get the filesbash
git clone https://github.com/YagnikBarasiya23/deck-toast-stack.git
# copy deck.js and deck.css into your project
Examplehtml
<link rel="stylesheet" href="deck.css">

<script type="module">
  import Deck from './deck.js';

  const toasts = new Deck({ position: 'bottom-right' });

  toasts.success('Changes saved');
  toasts.error('Upload failed', {
    message: 'report.pdf is larger than 10 MB.',
    action: { label: 'Retry', onClick: retry },
  });
  toasts.promise(publish(), {
    loading: 'Publishing…',
    success: count => `Published to ${count} feeds`,
    error: 'Publishing failed',
  });
</script>

Every option, the technique behind the motion and the accessibility notes are in the README on GitHub

More components

All 10
  • Web

    04 · Elastic tooltip

    Tether

    A tooltip hung on an elastic string.

    • 3.8 KB gzip
    • No dependencies
    • Free · MIT
  • Web

    05 · Product image zoom

    Loupe

    A lens that glides after your pointer.

    • 4.7 KB gzip
    • No dependencies
    • Free · MIT

Get in touch

Open for freelance projects, contract roles and collaborations — mobile apps and full-stack products in particular. WhatsApp gets the fastest reply.

Based in
Rajkot, Gujarat, India
Elsewhere