react-crisp-toast
Version:
A lightweight toast notification library for React.
38 lines (29 loc) • 928 B
TypeScript
import { default as default_2 } from 'react';
import { ReactNode } from 'react';
declare interface Toast {
id: string;
message: ReactNode;
type?: ToastType;
duration?: number;
position?: ToastPosition;
showCloseButton?: boolean;
soundEnabled?: boolean;
}
declare interface ToastContextType {
addToast: (toast: Omit<Toast, "id">) => void;
removeToast: (id: string) => void;
soundEnabled?: boolean;
}
declare interface ToastPosition {
vertical: "top" | "bottom";
horizontal: "left" | "right" | "center";
}
export declare const ToastProvider: default_2.FC<ToastProviderProps>;
declare interface ToastProviderProps {
children: default_2.ReactNode;
maxToasts?: number;
soundEnabled?: boolean;
}
declare type ToastType = "success" | "error" | "warning" | "info";
export declare const useToast: () => ToastContextType;
export { }