UNPKG

997 BTypeScriptView Raw
1import { IAlert, AlertProps as BaseAlertProps } from "../Alert";
2import { BoxProps } from "../Box";
3import { Omit } from "../common-types";
4import { Position } from "toasted-notes";
5import * as React from "react";
6
7export interface IToast extends IAlert {
8 /**
9 * The title of the toast.
10 */
11 title?: string;
12 /**
13 * If `true` adds a close button to the toast.
14 */
15 isClosable?: boolean;
16 /**
17 * Callback function to close the toast.
18 */
19 onClose?: () => void;
20 /**
21 * The description of the toast
22 */
23 description?: string;
24 /**
25 * Duration before dismiss in milliseconds, or `null` to never dismiss.
26 */
27 duration?: number | null;
28 /**
29 * One of toasted-notes positions.
30 */
31 position?: keyof typeof Position;
32}
33
34interface RenderOption {
35 render?: (props: { onClose: () => void; id: string }) => React.ReactNode;
36}
37export type useToastOptions = IToast & RenderOption;
38declare const useToast: () => (props: useToastOptions) => void;
39
40export default useToast;