UNPKG

2.11 kBTypeScriptView Raw
1import * as React from "react";
2import { AbstractPureComponent2 } from "../../common";
3import { ActionProps, IntentProps, LinkProps, MaybeElement, Props } from "../../common/props";
4import { IconName } from "../icon/icon";
5/** @deprecated use ToastProps */
6export declare type IToastProps = ToastProps;
7export interface ToastProps extends Props, IntentProps {
8 /**
9 * Action rendered as a minimal `AnchorButton`. The toast is dismissed automatically when the
10 * user clicks the action button. Note that the `intent` prop is ignored (the action button
11 * cannot have its own intent color that might conflict with the toast's intent). Omit this
12 * prop to omit the action button.
13 */
14 action?: ActionProps & LinkProps;
15 /** Name of a Blueprint UI icon (or an icon element) to render before the message. */
16 icon?: IconName | MaybeElement;
17 /**
18 * Whether to show the close button in the toast.
19 *
20 * @default true
21 */
22 isCloseButtonShown?: boolean;
23 /** Message to display in the body of the toast. */
24 message: React.ReactNode;
25 /**
26 * Callback invoked when the toast is dismissed, either by the user or by the timeout.
27 * The value of the argument indicates whether the toast was closed because the timeout expired.
28 */
29 onDismiss?: (didTimeoutExpire: boolean) => void;
30 /**
31 * Milliseconds to wait before automatically dismissing toast.
32 * Providing a value less than or equal to 0 will disable the timeout (this is discouraged).
33 *
34 * @default 5000
35 */
36 timeout?: number;
37}
38/**
39 * Toast component.
40 *
41 * @see https://blueprintjs.com/docs/#core/components/toast
42 */
43export declare class Toast extends AbstractPureComponent2<ToastProps> {
44 static defaultProps: ToastProps;
45 static displayName: string;
46 render(): JSX.Element;
47 componentDidMount(): void;
48 componentDidUpdate(prevProps: ToastProps): void;
49 componentWillUnmount(): void;
50 private maybeRenderActionButton;
51 private handleActionClick;
52 private handleCloseClick;
53 private triggerDismiss;
54 private startTimeout;
55}