@kwiz/fluentui
Version:
KWIZ common controls for FluentUI
60 lines (59 loc) • 1.68 kB
TypeScript
import { ToastId, ToastIntent, ToastPoliteness, ToastPosition } from "@fluentui/react-components";
export type toastOptionsType = {
/**
* Uniquely identifies a toast, used for update and dismiss operations
*/
toastId: ToastId;
/**
* The position the toast should render to
*/
position?: ToastPosition;
/**
* Auto dismiss timeout in milliseconds
* @default 3000
*/
timeout?: number;
/**
* Toast timeout pauses while focus is on another window
* @default false
*/
pauseOnWindowBlur?: boolean;
/**
* Toast timeout pauses while user cursor is on the toast
* @default false
*/
pauseOnHover?: boolean;
/**
* Higher priority toasts will be rendered before lower priority toasts
*/
priority?: number;
/**
* Used to determine [aria-live](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions) narration
* This will override the intent prop
*/
politeness?: ToastPoliteness;
};
export type toastDispatcherType = (info: {
title?: string;
body?: string;
/** shows only with body */
subtitle?: string;
titleAction?: {
text: string;
onClick: () => void;
};
footerActions?: {
text: string;
onClick: () => void;
}[];
intent?: ToastIntent | "progress";
media?: JSX.Element;
inverted?: boolean;
} & Partial<toastOptionsType>) => void;
export declare function useToast(): {
control: JSX.Element;
dispatch: toastDispatcherType;
dismiss: (toastId: ToastId) => void;
dismissAll: () => void;
update: (info: toastOptionsType) => void;
};