Toaster draws nothing where you put it and starts after the page has loaded, so server rendering is safe. In Nuxt, put it in app.vue and call toast from client code, like a click handler. We ran it in Vue with Vite and in Nuxt 4, in development and in a production build.
The React build now starts with "use client". Until now, importing Toaster in a server layout failed, so you needed your own client component around it. You don't any more.
// app/layout.tsx, a server component
import { Toaster } from '@yusufceng1z/ding-react';
export default function RootLayout({ children }) {
return (
<html lang="en">
<body>
<Toaster />
{children}
</body>
</html>
);
}
Call toast from client components only. See the Next.js guide.
Ding puts its styles in one <style> element. If your style-src blocks inline styles, give it your page's nonce. Only that element needs it, because the per-toast values are set through the DOM, which CSP allows.
When a toast changed its own text while it ran, like a download with a moving percentage, the text animation played again on every update and the title looked like it was shaking. Now the animation only plays when the title really becomes something new, such as "Download complete".
Watch the title while the numbers change. It should stay still until the end.
In the plain DOM renderer, which Vue and Nuxt use, an error toast has a close button. If it then turned into a toast with an action, like Undo, the close button ended up in front of the action. It now stays at the end. React and Svelte were not affected.
Open the error, then press Undo. The buttons should read Undo, then close.
Buttons: -
For contributors
The React, Svelte, Vue and plain DOM renderers now each have render tests, and CI runs them on every pull request. Thanks to Amidou Cissé for pull request 13 and the three before it.