diff --git a/src/index.tsx b/src/index.tsx index e75a979..a15b893 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -239,7 +239,14 @@ const Toast = (props: ToastProps) => { role="status" tabIndex={0} ref={toastRef} - className={cn(className, toastClassname, classNames?.toast, toast?.classNames?.toast)} + className={cn( + className, + toastClassname, + classNames?.toast, + toast?.classNames?.toast, + classNames?.[toastType], + toast?.classNames?.[toastType], + )} data-sonner-toast="" data-styled={!Boolean(toast.jsx || toast.unstyled)} data-mounted={mounted} diff --git a/src/types.ts b/src/types.ts index 44a908b..f867b90 100644 --- a/src/types.ts +++ b/src/types.ts @@ -19,6 +19,10 @@ export interface ToastClassnames { closeButton?: string; cancelButton?: string; actionButton?: string; + success?: string; + error?: string; + info?: string; + warning?: string; } export interface ToastT { diff --git a/website/src/pages/styling.mdx b/website/src/pages/styling.mdx index 753fc85..f74d7ad 100644 --- a/website/src/pages/styling.mdx +++ b/website/src/pages/styling.mdx @@ -58,6 +58,21 @@ toast('Hello World', { }); ``` +Styling per toast type is also possible. + +```jsx + +``` + ## No styles You can also disable default styles by going headless.