UNPKG

1.46 kBTypeScriptView Raw
1/// <reference types="react" />
2import type { ActionProps, IntentProps, LinkProps, MaybeElement, Props } from "../../common/props";
3import type { IconName } from "../icon/icon";
4export interface ToastProps extends Props, IntentProps {
5 /**
6 * Action rendered as a minimal `AnchorButton`. The toast is dismissed automatically when the
7 * user clicks the action button. Note that the `intent` prop is ignored (the action button
8 * cannot have its own intent color that might conflict with the toast's intent). Omit this
9 * prop to omit the action button.
10 */
11 action?: ActionProps & LinkProps;
12 /** Name of a Blueprint UI icon (or an icon element) to render before the message. */
13 icon?: IconName | MaybeElement;
14 /**
15 * Whether to show the close button in the toast.
16 *
17 * @default true
18 */
19 isCloseButtonShown?: boolean;
20 /** Message to display in the body of the toast. */
21 message: React.ReactNode;
22 /**
23 * Callback invoked when the toast is dismissed, either by the user or by the timeout.
24 * The value of the argument indicates whether the toast was closed because the timeout expired.
25 */
26 onDismiss?: (didTimeoutExpire: boolean) => void;
27 /**
28 * Milliseconds to wait before automatically dismissing toast.
29 * Providing a value less than or equal to 0 will disable the timeout (this is discouraged).
30 *
31 * @default 5000
32 */
33 timeout?: number;
34}