haptic-sound-toast
Version:
A customizable toast notification library for Next.js and React
28 lines (27 loc) • 1.01 kB
TypeScript
export type ToastType = 'success' | 'error' | 'info' | 'warning';
export interface ToastOptions {
id?: string;
type?: ToastType;
duration?: number;
position?: 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
sound?: boolean;
customSound?: null | undefined;
customIcon?: null | undefined;
description?: string;
showProgress?: boolean;
className?: string;
vibration?: boolean;
customVibration?: null | undefined;
action?: null | undefined;
pauseOnHover?: boolean;
swipeToClose?: boolean;
role?: string;
}
export interface ToastContextType {
success: (message: string, options?: ToastOptions) => string;
error: (message: string, options?: ToastOptions) => string;
info: (message: string, options?: ToastOptions) => string;
warning: (message: string, options?: ToastOptions) => string;
custom: (message: string, options?: ToastOptions) => string;
dismiss: (id?: string) => void;
}