Dynamic Island–style toast notifications for web applications. Zero dependencies · Lightweight (~5KB gzipped) · Accessible · SSR-safe
TikTiktoast is a Dynamic Island–style toast/notification library for web applications.
It is lightweight (~5KB gzipped), zero dependencies, accessible, and SSR-safe, built with Vanilla JS + TypeScript + Web Animations API.
Perfect for vanilla JavaScript, TypeScript, React, Next.js, Nuxt, or any modern framework.
- 🏝️ Dynamic Island morphing — Pill-to-card transitions with spring easing
- 📚 Stacking & queue — Max 5 visible, rest queued with animated reflow
- 🔄 Promise tracking —
loading → success/errortransitions in one API call - 🔁 Deduplication — Same
idupdates toast in place with morph animation - 📊 Progress bar — 2px WAAPI-animated countdown bar
- 👆 Swipe to dismiss — Rubber-band gesture (lazy-loaded module)
- 🌐 RTL support — Auto-detected, flips icons, text, and swipe direction
- ♿ Accessible —
role="alert",aria-live, keyboard navigation,Alt+Tfocus - 🖥️ SSR safe — No
window/documentaccess at import time - 🎯 Zero dependencies — Pure Vanilla JS + TypeScript + Web Animations API
- 🎬 Reduced motion — Respects
prefers-reduced-motion: reduce - 🎨 Customizable — CSS variables, custom icons, custom renderers
npm install tiktiktoastyarn add tiktiktoastpnpm add tiktiktoast<script src="https://unpkg.com/tiktiktoast/dist/tiktik.umd.js"></script>
<script>
Tiktik.success('Hello from CDN!')
</script>import { Tiktik } from 'tiktiktoast'
// One line. That's it.
Tiktik.success('Changes saved!')
Tiktik.error('Something went wrong.')
Tiktik.warning('Disk space running low.')
Tiktik.info('New update available.')Tiktik.success(message, options?) // ✓ green accent
Tiktik.error(message, options?) // ✕ red accent
Tiktik.info(message, options?) // ℹ blue accent
Tiktik.warning(message, options?) // ⚠ orange accentTiktik.showToast({
message: 'Hello world',
type: 'success', // 'success' | 'error' | 'info' | 'warning'
duration: 3000, // ms, default: 3000. Use Infinity for persistent
position: 'top', // 'top' | 'bottom'
icon: '<svg>...</svg>', // custom SVG string or SVGElement
progress: true, // show countdown progress bar
id: 'unique-key', // dedup key — same id updates in place
onClick: () => {},
onDismiss: () => {}
})Tiktik.promise(fetch('/api/save'), {
loading: 'Saving...',
success: (data) => `Saved! ${data.name}`,
error: (err) => `Failed: ${err.message}`,
duration: 3000,
})const id = Tiktik.success('Dismissible')
Tiktik.dismiss(id) // dismiss one
Tiktik.dismiss() // dismiss allTiktik.configure({
type: 'info',
duration: 5000,
position: 'bottom',
progress: true,
})Tiktik.onStackChange((visible, queued) => {
console.log(`Visible: ${visible}, Queued: ${queued}`)
})Override CSS variables on :root:
:root {
--tiktik-bg: #1a1a2e;
--tiktik-text: #ffffff;
--tiktik-radius-pill: 9999px;
--tiktik-radius-card: 24px;
--tiktik-shadow: 0 4px 16px rgba(0,0,0,0.3);
--tiktik-z-index: 999999;
--tiktik-font-size: 14px;
--tiktik-duration: 320ms;
}| Chunk | Size (gzip) |
|---|---|
| Base | ~5 KB |
| Gestures (lazy) | ~0.75 KB |
| Promise (lazy) | ~0.5 KB |
Gesture and promise modules are lazy-loaded. Initial bundle stays lean.
All modern browsers with Web Animations API support:
| Chrome | Firefox | Safari | Edge |
|---|---|---|---|
| 36+ | 48+ | 13.1+ | 79+ |
Contributions welcome! Open an issue or submit a pull request.
MIT — Free for personal and commercial use.
- NPM: https://www.npmjs.com/package/tiktiktoast
- Homepage / Live Demo: https://tiktiktoast.vercel.app
- Documentation: https://tiktiktoast.vercel.app/docs
- Repository: https://github.com/ianpurifying/Tiktik