Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for multiple toasters #383

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open

Add support for multiple toasters #383

wants to merge 15 commits into from

Conversation

timolins
Copy link
Owner

@timolins timolins commented Jan 6, 2025

This PR implements the ability to have multiple toasters at once.

// Create a toaster with a custom id
<Toaster id="custom-toaster" />;

// Create a toast within the new toaster
toast.success('Nice toast!', {
  toasterId: 'custom-toaster',
});
<Toaster /> // Default toaster
<div>
  <Toaster
    toasterId="area1"
    containerStyle={{ position: 'absolute' }}
  />
</div>
<div>
  <Toaster
    toasterId="area2"
    containerStyle={{ position: 'absolute' }}
  />
</div>

Related issue

Closes #158

Copy link

vercel bot commented Jan 6, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-hot-toast ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 21, 2025 9:45pm

Copy link

github-actions bot commented Jan 6, 2025

size-limit report 📦

Path Size
dist/index.js 5.3 KB (+4.76% 🔺)
dist/index.mjs 4.99 KB (+5.23% 🔺)
headless/index.js 2.07 KB (+12.4% 🔺)
headless/index.mjs 1.79 KB (+14.74% 🔺)

@GitScorz
Copy link

Is this ready? I really need this, but the latest version is still 2.5.1.

@timolins
Copy link
Owner Author

I just published v2.6.0-beta.0, which adds support for multiple toasters. You can give it a try with npm i react-hot-toast@beta. Testers and feedback are much appreciated.

@maxratajczak
Copy link

I just published v2.6.0-beta.0, which adds support for multiple toasters. You can give it a try with npm i react-hot-toast@beta. Testers and feedback are much appreciated.

So far I've been testing/using the beta and it's working great 👍 Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support multiple <Toaster> elements
3 participants