reactjs-toaster
Version:
The React JS Toaster (reactjs-toaster) is lightweight JavaScript/TypeScript based Toast message library for showing Error , Success , Warning and Info message in UI End.
21 lines (20 loc) • 1.05 kB
TypeScript
import * as React from 'react';
import { ToastMessage, ToastPosition, ToastType, ToastsProps } from './types/toastTypes';
interface ToastContextType {
addToast: (toast: Omit<ToastsProps, 'id'>) => void;
removeToast: (id: string) => void;
showToast?: any;
setClassName?: any;
setStyles?: any;
addToaster?: (toaster: Omit<ToastMessage, 'id'>) => void;
}
export declare const ToastContext: React.Context<ToastContextType | undefined>;
export declare function ToastProvider({ children }: {
children: React.ReactNode;
}): React.JSX.Element;
export declare const useToastHook: () => ToastContextType;
export declare function setGlobalAddToast(addToast: ToastContextType['addToast']): void;
export declare function setGlobalAddToaster(addToaster: ToastContextType['addToaster']): void;
export declare function toast(type: ToastType, message: string, duration?: number, position?: ToastPosition): void;
export declare function toaster(type: ToastType, message: string, duration?: number, position?: ToastPosition): void;
export {};