Skip to main content

Multiple Toaster components

Supports multiple Toaster components within the same view.

Example

import { toast, Toaster } from "@toastup/react";
import "@toastup/react/style";

export function MultiToasterExample() {
const handleClickLeft = () =>
toast.add({
rtl: true,
toasterId: "toaster-left",
type: "success",
position: "bottom-left",
});

const handleClickRight = () =>
toast.add({ rtl: true, toasterId: "toaster-right" });

return (
<div>
<div className={styles.buttonsRow}>
<button onClick={handleClickLeft}>Add toast left</button>
<button onClick={handleClickRight}>Add toast right</button>
</div>
<Toaster toasterId="toaster-left" />
<Toaster toasterId="toaster-right" />
</div>
);
}