This is a submission for the GitHub Finish-Up-A-Thon Challenge
What I Built
toastr-next v3 a complete revival of CodeSeven/toastr, one of the most-starred abandoned JavaScript libraries on GitHub with 12,000+ stars and no meaningful commits since 2016.
toastr was the go-to notification library for millions of developers. But time wasn't kind to it. it required jQuery, had no TypeScript, no dark mode, no accessibility, and its Gulp + LESS build chain was completely dead. It was a library everyone knew but nobody could use in a modern project without guilt.
I picked it up, stripped it to the bones, and rebuilt it from scratch for 2026.
From this ππ»:
// 2015 β drag in jQuery just to show a toast
<script src="jquery.min.js"></script> // 30 KB
<script src="toastr.min.js"></script> // 5 KB
// Total: ~87 KB of dead weight
toastr.success('Hello!');
To this ππ»:
// 2026 β zero dependencies, full TypeScript, ~4 KB gzipped
import { toastr } from 'toastr-next';
const toast = toastr.success('Hello!');
await toast.dismissed; // Promise API!
~4 KB gzipped. No jQuery. No bloat. Just toasts. π
Demo
Dark mode β toasts firing with progress bar
Light mode β same demo, toggled with the βοΈ button
π Live Demo: toastr-next.vercel.app/
π¦ npm: npmjs.com/package/toastr-next
π GitHub: github.com/Divyesh-5981/toastr-next
The Comeback Story
Where it was

The original repo β abandoned since 2016, 12k stars, zero recent activity
| Problem | Detail |
|---|---|
| jQuery required | ~87 KB overhead just to show a notification |
| No TypeScript | No types, no IntelliSense, no safety |
| No dark mode | Hard-coded colors, no CSS variables |
| No accessibility | Screen readers couldn't detect toasts at all |
| JS-driven animations | Layout thrash, janky on low-end devices |
| No Promise API | No way to await a toast dismissal |
| No keyboard support | Couldn't dismiss with Escape key |
| Dead build toolchain | Gulp + LESS, completely unmaintained since 2016 |
| No ESM support | Global UMD only, no tree-shaking |
What I built
π TypeScript Rewrite (Zero Dependencies)
- No jQuery: 100% strict TypeScript with full JSDoc.
-
Universal Formats: Ships in ESM, CJS, UMD, and IIFE (works from Vite to raw
<script>tags).
π¨ CSS-First Theming
- Modern CSS: Uses CSS variables instead of inline JS styles.
-
Themes & Motion: Auto dark mode (
prefers-color-scheme), manual toggle (localStorage), andprefers-reduced-motionsupport. - Layouts: 4 pure CSS animation presets (Fade, Slide, Bounce, Flip) and native RTL support.
βΏ Accessibility (built to WCAG 2.1 AA practices)
-
Screen Readers: Dynamic ARIA live regions
role="alert"(assertive) for errors/warnings androle="status"(polite) for success/info, witharia-atomic. - Keyboard Navigation: Toasts are focusable and sit in the natural tab order; pressing Escape while a toast is focused dismisses it, and auto-dismiss pauses while a toast holds focus.
π Modern API
Async & Events: Promises (
await toast.dismissed) and lifecycle event subscriptions (toastr.subscribe, which returns an unsubscribe function).DX & Security: Automatic CSS injection (no separate stylesheet import), native React wrapper (
useToastr), and built-in XSS protection.
π¦ Production Ready
- Lightweight: ~4 KB gzipped (~2 KB JS + ~2 KB CSS) vs the original ~87 KB jQuery version.
-
Live: Available on npm as
toastr-nextwith a live Vercel demo.
Size comparison
| toastr v2 (old) | toastr-next v3 | |
|---|---|---|
| Total size | ~87 KB (with jQuery) | ~4 KB gzipped |
| Dependencies | jQuery required | Zero |
| TypeScript | β | β |
| Dark mode | β | β Auto + manual toggle |
| Accessibility | β | β WCAG 2.1 AA practices |
| Promise API | β | β |
| React support | Third-party only | β Built-in |
| Animations | JS (jQuery) | β CSS @keyframes |
| Bundle formats | Global UMD only | β ESM, CJS, UMD, IIFE |
| CSS import | Required | β Auto-injected |
My Experience with GitHub Copilot
I used GitHub Copilot as a pair programmer throughout the entire revival not for autocomplete, but as a genuine collaborator at every architectural decision.
Here's exactly how it helped, step by step.
1. Deciding what to keep
Before writing a single line, I needed to know what was worth saving from 14 years of jQuery-tangled code.
Prompt:
"Here is the original toastr v2 source. What's worth keeping
for backward compatibility and what should be completely rewritten?"
Copilot identified the API surface success, error, info, warning β as the only thing worth preserving. Everything underneath needed to go. This became the guiding rule for the entire rewrite.
2. TypeScript interfaces
With the API surface locked, I needed a clean type system built around it.
Prompt:
"Design TypeScript interfaces for ToastrOptions, ToastResponse,
and ToastEvent. I want every toast call to return a Promise
that resolves when the toast is dismissed."
Copilot designed all three interfaces. The standout was the dismissed: Promise<void> pattern on ToastResponse making every toast awaitable:
const { dismissed } = toastr.success('Changes saved');
await dismissed;
// runs after the toast closes
I didn't ask for this pattern specifically. Copilot suggested it unprompted, and it became the most-loved feature of the rewrite.
3. Theming system
I wanted dark mode to work automatically and be manually overridable without JavaScript touching the CSS side.
Prompt:
"I need a CSS theming system that supports auto dark mode via
prefers-color-scheme AND manual override via a data-theme attribute
on the html element. No JavaScript should be needed for the CSS side."
Copilot proposed the [data-theme] + @media (prefers-color-scheme) layering pattern. The media query handles auto mode; a single attribute flip handles manual override. No JS. No flicker. Just CSS doing its job.
4. Accessibility
I had applied role="alert" to all four toast types, assuming it was correct. I asked Copilot to review before shipping.
Prompt:
"What ARIA roles and aria-live values should toast notifications use
to be WCAG 2.1 AA compliant? Should all toasts use the same role?"
Copilot flagged that role="alert" is assertive it interrupts a screen reader mid-sentence. That's right for errors and warnings, but jarring for a success message. The fix:
| Type | Role | Behaviour |
|---|---|---|
error, warning
|
role="alert" |
Interrupts immediately |
success, info
|
role="status" |
Waits for a pause |
A subtle WCAG 2.1 distinction I would have shipped wrong without this review.
5. CSS auto-injection
Early users kept asking why they had to import the CSS separately. That broke the drop-in promise. I needed the stylesheet bundled inside the JS, self-injecting on import.
Prompt:
"Write a Vite generateBundle plugin that reads the extracted CSS asset
and injects it into every JS chunk as a self-executing style injector.
Add a guard so it only injects once even if the module is imported
multiple times, and make it safe to run during SSR."
Copilot drafted the generateBundle plugin β CSS-to-string conversion plus a self-executing injector that appends a <style id="__toastr_next_css__"> to <head>. The guard checks document.getElementById(...) so it only injects once even if multiple bundles (core + React) load on the same page, and it bails out when document is undefined (SSR-safe). I later refactored it into one shared plugin reused across the core, IIFE, and React builds.
This was the most technically complex Copilot collaboration in the project and the one that impressed me most.
6. Demo page
The final piece was a demo site that actually showed off everything that changed.
Prompt:
"Build a demo page for toastr-next with a quick fire section,
a live playground with dropdowns for type/animation/position,
an animation showcase, a before/after comparison, and a light/dark
theme toggle that persists to localStorage."
Copilot built the full index.html iteratively playground, comparison table, custom ARIA dropdown, and the light/dark toggle with localStorage persistence. I directed; it executed. The entire demo came together in an afternoon.
What I took away
Copilot wasn't writing boilerplate it was catching real bugs, proposing patterns I hadn't considered, and solving problems I didn't know how to start. The dismissed: Promise<void> feature, the WCAG role distinction, and the CSS-injection plugin were all things I got from Copilot that I wouldn't have shipped on my own.
That's the kind of collaboration this challenge is designed to reward.
After the main rewrite, I ran the entire codebase through GitHub Copilot to audit for hidden anti-patterns and code smells. It helped me spot subtle optimizations and edge cases, allowing me to refine the code into a truly polished, production-grade architecture.
The audit - for hidden anti-patterns and code smells.
Improvements - for hidden anti-patterns and code smells.
Working with Copilot felt less like using a tool and more like having a senior developer who knew every API, caught every edge case, and never got tired. The revival that would have taken weeks took days.
Acknowledgements
Huge respect to the original authors β John Papa, Tim Ferrell, and
Hans FjΓ€llemark - who built something so good that developers were still reaching for it a decade later.
This revival exists because their original work was worth finishing β€οΈ




Top comments (29)
Very cool
The accessibility gap you fixed is the one that always gets deferred β
role="alert"and live regions sound simple until you realize the original library had no awareness of the DOM announcement lifecycle at all, meaning screen readers were just silently ignoring every toast. I ran into the same thing auditing a component library last year: the visual experience was polished, but assistive technology users got nothing. Theawait toast.dismissedPromise API is a nice touch too β it closes the loop on a pattern where most notification libraries fire-and-forget and leave callers polling or guessing whether the user actually saw the message.Thank you, I really appreciate this! Accessibility definitely gets pushed to the backlog too often, so Iβm glad this fix resonated with you. And I'm thrilled you liked the Promise API hopefully, it saves developers a few headaches. Thanks for the kind words!
the jquery removal alone is probably half the value here. every "why is this still installed" conversation gets shorter.
Reviving a 12k star abandoned library is basically open source necromancy at this point π
Also love how the old setup was:
βimport all of jQuery to show one toastβ
Frontend in 2015 was truly built different π
Open source necromancy is the perfect way to describe it π I am just glad to finally lay the old jQuery dependency to rest!
Fantastic job! Stripping the jQuery-shackled classic down to a ~4KB pure, native TypeScript architecture is the ultimate cleanup of technical debt. From the CSS-first approach to the precise WCAG accessibility role tuning, it shows a profound respect for low-level detail. Reviving a legendary library with such elegance is a massive win for the ecosystem!
Great work rescuing this library! 12K stars is a serious signal that people rely on it. I've always appreciated toastr's simplicity β it just works without the complexity of modern notification solutions.
Curious about the migration path from v2 to v3 β did you find many breaking changes in the DOM structure or was it mostly TypeScript cleanup? And are you planning to keep the jQuery dependency or eventually drop it?
Followed to see where this goes! π
Appreciate the support and the follow! π To answer your question: jQuery is already dropped entirely! That was actually the main goal of v3.
Itβs now a pure, zero-dependency TypeScript rewrite (~4 KB gzipped). We switched to native CSS @keyframes for animations and vanilla JS for the DOM. It also ships with all modern builds (ESM/CJS, etc.) and a React hook right out of the box so it plays nicely with modern setups. Thanks for following along!"
That's even better than I hoped β zero-dependency TypeScript rewrite with React hook support means it's essentially a new library built on toastr's design DNA. The 4 KB gzipped size is impressive for what it does.
The ESM/CJS dual build is a nice touch too. Are you planning to publish a migration guide for existing v2 users, or is the API similar enough that most people can just swap the import?
Thanks! There's already a migration guide in the README with before/after diffs.
For basic usage it's close to a drop-in toastr.success("Saved!") works the same, and the DOM/CSS class names are unchanged so custom styling carries over. Just swap the import (CSS auto-injects now):
A few intentional breaking changes:
Calls now return a ToastInstance instead of a jQuery object
jQuery animation options replaced with a single animation preset
escapeHtml changed to allowHtml (HTML is escaped by default now)
subscribe() now returns an unsubscribe function
The guide explains each change.
I was in a similar spot with 'There's already a migration guide in the README with before/...'. What worked for us was lighter in-memory caching. Curious if you considered that?
Great breakdown of 'There's already a migration guide in the README with before/...'. Did you run into edge cases with production traffic? We sure did π
Not yet, but Iβm pretty sure some edge cases will appear once it gets real production traffic π
I also tried it by creating a CodeSandbox environment and it worked really well there.
Curious what kind of issues did you run into?
From 87KB of jQuery guilt to 4KB zero-dep TypeScript β this is exactly the kind of cleanup the ecosystem needed. Well done! π₯
Thank you! It was wild seeing just how much weight we could drop by switching to modern CSS custom properties and native Promises. Zero-dep was the hill I wanted to die on for this rewrite! π―
Great work man π₯
Thanks so much! π€ Couldn't have done it without GitHub Copilot π€
Well Explained!
Thanks, man!
Some comments may only be visible to logged-in visitors. Sign in to view all comments.