ndd-react
Version:
A lightweight, customizable toast notification library for React applications
23 lines (22 loc) • 675 B
TypeScript
import React from 'react';
type ToastType = 'success' | 'error' | 'info' | 'warning';
interface Toast {
id: string;
message: string;
type: ToastType;
duration?: number;
position?: ToastPosition;
}
type ToastPosition = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'top-center' | 'bottom-center';
interface ToastContextState {
toasts: Toast[];
}
export declare const ToastProvider: React.FC<{
children: React.ReactNode;
}>;
export declare const useToast: () => {
state: ToastContextState;
addToast: (toast: Omit<Toast, "id">) => void;
removeToast: (id: string) => void;
};
export type { Toast, ToastType, ToastPosition };