UNPKG

1.01 kBTypeScriptView Raw
1import type { OverlayToasterProps } from "./overlayToasterProps";
2import type { ToastProps } from "./toast";
3export type ToastOptions = ToastProps & {
4 key: string;
5};
6/** Instance methods available on a toaster component instance. */
7export interface Toaster {
8 /**
9 * Shows a new toast to the user, or updates an existing toast corresponding to the provided key (optional).
10 *
11 * Returns the unique key of the toast.
12 */
13 show(props: ToastProps, key?: string): string;
14 /** Dismiss the given toast instantly. */
15 dismiss(key: string): void;
16 /** Dismiss all toasts instantly. */
17 clear(): void;
18 /** Returns the props for all current toasts. */
19 getToasts(): ToastOptions[];
20}
21export type ToasterInstance = Toaster;
22export declare const Toaster: {
23 create: typeof deprecatedToasterCreate;
24};
25/** @deprecated use OverlayToaster.create() instead */
26declare function deprecatedToasterCreate(props?: OverlayToasterProps, container?: HTMLElement): Toaster;
27export {};