Configuration
Set renderer defaults with props, or change them at runtime with toast.setConfig.
Renderer props
| Prop | Type | Default | Purpose |
|---|---|---|---|
| position | ToastPosition | "top-center" | Stack position |
| richColors | boolean | false | Semantic accents |
| closeButton | boolean | false | Close control |
| maxVisible | number | 4 | Visible toast limit |
| unstyled | boolean | false | Disable style injection |
Recommended setup
import { NextToast } from "next-toast";
<NextToast
position="top-right"
richColors
closeButton
maxVisible={4}
/>Position
Choose top-left, top-center, top-right, bottom-left, bottom-center, or bottom-right.
Move the stack
toast.setConfig({ position: "bottom-right" });Runtime configuration
Runtime changes affect current and future toasts.
toast.setConfig
toast.setConfig({
position: "top-center",
richColors: false,
closeButton: false,
maxVisible: 4,
});External stylesheet and CSP
For strict Content Security Policies, import the packaged CSS and disable injection.
providers.tsx
import "next-toast/styles.css";
import { NextToast } from "next-toast";
export function Providers() {
return <NextToast unstyled />;
}Theme customization
Override scoped variables on .nx-toaster. Global root styles are untouched.
app.css
.nx-toaster {
--nx-radius: 10px;
--nx-success: #0d9488;
--nx-font: "Inter", sans-serif;
}