diff --git a/src/index.tsx b/src/index.tsx index 397e3e9..b22cd52 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -361,11 +361,11 @@ const Toast = (props: ToastProps) => { data-button data-cancel style={toast.cancelButtonStyle || cancelButtonStyle} - onClick={() => { + onClick={(event) => { if (!dismissible) return; deleteToast(); if (toast.cancel?.onClick) { - toast.cancel.onClick(); + toast.cancel.onClick(event); } }} className={cn(classNames?.cancelButton, toast?.classNames?.cancelButton)} diff --git a/src/types.ts b/src/types.ts index 489b369..eab1a96 100644 --- a/src/types.ts +++ b/src/types.ts @@ -42,12 +42,12 @@ export interface ToastT { delete?: boolean; important?: boolean; action?: { - label: string; + label: React.ReactNode; onClick: (event: React.MouseEvent) => void; }; cancel?: { - label: string; - onClick?: () => void; + label: React.ReactNode; + onClick?: (event: React.MouseEvent) => void; }; onDismiss?: (toast: ToastT) => void; onAutoClose?: (toast: ToastT) => void;