@nozzlegear/react-win-dialog
Version:
An attempt to recreate the Dialog element from WinJS.
72 lines (71 loc) • 2.06 kB
TypeScript
import * as React from 'react';
export declare type Props = React.PropsWithChildren<{
/**
* The dialog's title.
*/
title: string;
/**
* Whether the dialog is open or not.
*/
open: boolean;
/**
* Change's the dialog's outline and primary button color to red when true.
*/
danger?: boolean;
/**
* Indicates that data is being loaded or saved.
*/
loading?: boolean;
/**
* A custom component to use as the loading indicator when {@link Props.loading} is true.
* @default `<progress />`
*/
loadingComponent?: React.ReactNode | (() => React.ReactNode);
/**
* Whether the dialog should hide its primary and secondary buttons when {@link Props.loading} is true.
*
*/
loadingHidesButtons?: boolean;
/**
* The dialog's primary (right) button text.
*/
primaryText?: string;
/**
* The dialog's secondary (left) button text.
*/
secondaryText?: string;
/**
* Event handler called when the primary (right) button is clicked.
*/
onPrimaryClick?: (event: React.FormEvent<HTMLButtonElement>) => void;
/**
* Event handler called when the secondary (left) button is clicked.
*/
onSecondaryClick?: (event: React.FormEvent<HTMLButtonElement>) => void;
/**
* Style object applied to the dialog's overlay.
*/
overlayStyle?: React.CSSProperties;
/**
* Whether the dialog should prevent scrolling of the body elements under/behind the dialog when the dialog is open.
* @default true
*/
overlayPreventsScrolling?: boolean;
/**
* Style object applied to the dialog container.
*/
containerStyle?: React.CSSProperties;
/**
* Style object applied to the dialog.
*/
dialogStyle?: React.CSSProperties;
/**
* Id applied to the dialog container.
*/
id?: string;
/**
* Classname applied to the dialog container.
*/
className?: string;
}>;
export declare function Dialog(props: Props): JSX.Element;