rharuow-ds
Version:
Modern React Design System with 20 components and auto color system. Define only 2 colors (primary/secondary) and get automatic variations (hover, light, dark) with proper text contrast (WCAG AA). Includes: Table, Card, Button, Chip, Pagination, Input, Te
32 lines (31 loc) • 1.17 kB
TypeScript
import React from "react";
export type ToastVariant = "success" | "error" | "warning" | "info" | "default";
export type ToastPosition = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
export interface Toast {
id: string;
message: string;
variant?: ToastVariant;
duration?: number;
onClose?: () => void;
}
interface ToasterContextValue {
toasts: Toast[];
addToast: (toast: Omit<Toast, "id">) => string;
removeToast: (id: string) => void;
clearAll: () => void;
}
export interface ToasterProviderProps {
children: React.ReactNode;
position?: ToastPosition;
maxToasts?: number;
}
export declare const ToasterProvider: React.FC<ToasterProviderProps>;
export declare const useToaster: () => ToasterContextValue;
export declare const useToast: () => {
toast: (message: string, options?: Omit<Toast, "id" | "message">) => string;
success: (message: string, duration?: number) => string;
error: (message: string, duration?: number) => string;
warning: (message: string, duration?: number) => string;
info: (message: string, duration?: number) => string;
};
export {};