A dialog component in react that handle full screen containers, modals, alerts and dialogs.

Parameters:
NameTypeDescription
propsobject

Component props.

Properties
NameTypeDescription
alertButtonTextstring

If in alert mode, the text for the ok button below content.

alignmentstring

Position of message in window.

animateModalboolean

When in modal or dialog mode, animate the dialog in with a fade in and up?

animationDelaynumber

The css animation delay for the reveal/hide effect. Synchronize with css if modifying the built-in 250 ms delay.

buttonWidthstring

The button width, one of auto or full.

cancelButtonHeightstring

The height for the cancel button.

cancelButtonTextstring

If in dialog mode, the white cancel buttons text is set here.

cancelButtonTypestring

The type of the cancel button.

childrenJSX.Element

React element children.

closeButtonSizestring

The close button size. Default is xs.

closeButtonTitlestring

The close button title for accessibility purposes.

closeButtonTypestring

The close button type. Default is round. Also supports noborder and unstyled.

closeOnMaskClickboolean

Whether to close if the background mask is clicked.

confirmButtonAttributesobject

Arbitrary additional html attributes for the confirm button if in dialog mode.

confirmButtonHeightstring

The height of the confirm button.

confirmButtonIconstring

If in dialog mode, the optional confirmation button icon before the button text.

confirmButtonTextstring

If in dialog mode, the confirmation button text.

confirmButtonTypestring

The type of the confirm button.

contentstring

Container content. Can only be strings. Use React children for html.

customCloseButtonClassesstring | Array | object

Custom classes for the close button as array.

customMaskClassesstring | Array | object

Custom classes for the mask as array.

customWrapperClassesstring | Array | object

Custom classes for the wrapper as array.

descriptionstring | Array | object

Optional text to show below title.

idstring

The id for the dialog. If not passed auto generated using uniqueId from our utils with a prefix of dialog.

isOpenboolean

Prop to control whether the dialog is currently open.

lockBodyboolean

Whether to lock the body behind the dialog to prevent interaction or scrolling.

maskBlurboolean

Whether to blur behind the mask for the dialog.

maskThemestring

Mask background color scheme: none, light or dark.

maxHeightstring

Max height for the dialog.

modestring

Container mode: container, modal, alert or dialog.

onClosefunction

Function to execute when the dialog closes.

onCloseAfterAnimationfunction

Function to execute after the dialog close animation.

onOpenfunction

Function to execute when the dialog opens.

onOpenAfterAnimationfunction

Function to execute after the dialog open animation.

padContentboolean

Whether to pad the content on the right or not.

positionstring

Position for the mask: fixed, absolute.

showCancelButtonboolean

Whether to show the cancel button or not.

showCloseButtonboolean

Whether to show the close button top right or not.

showConfirmButtonboolean

Whether to show the confirm button or not.

simplebarboolean

Whether or not to use SimpleBar on the content.

themestring

Theme for the dialog, one of gravity-blue or cosmos.

titlestring

Title for the dialog. Does not show in container mode.

titleDividerboolean

Whether to show a divider below the title or not.

titleIndicatorTypestring

Indicator type for the dialog title.

titleSizestring

Size for the title, sm or md currently.

titleTagNamestring

Tagname for the title of the dialog.

zIndexnumber

The z-index for the dialog.

refobject | null

Ref to the component.

Since
  • 1.1.15
Returns:

Return the functional dialog component in React.

Type: 
JSX.Element
Example
import Dialog from '@gravityforms/components/react/admin/modules/Dialog';

const Example = () => {
    	const dialogArgs = {
		    closeOnMaskClick: false,
		    customCloseButtonClasses: [ 'gform-example--exit-button' ],
		    customWrapperClasses: [
			    'gform-example',
		    ],
		    id: 'test-id',
		    isOpen,
		    lockBody: true,
		    mode: 'container',
		    zIndex: 100001,
     };

     return (
         <Dialog { ...dialogArgs }>
             { children }
         </Dialog>
     );
}