The Dialog component is used to show content on top of an overlay that requires user interaction.
children
Requirednode | func
Children can be a string, node or a function accepting `({ close })`. When passing a string, <Paragraph /> is used to wrap the string.
intent
string
The intent of the Dialog. Used for the button.
isShown
bool
When true, the dialog is shown.
title
node
Title of the Dialog. Titles should use Title Case.
hasHeader
bool
When true, the header with the title and close icon button is shown.
header
node | func
You can override the default header with your own custom component. This is useful if you want to provide a custom header and footer, while also enabling your Dialog's content to scroll. Header can either be a React node or a function accepting `({ close })`.
hasFooter
bool
When true, the footer with the cancel and confirm button is shown.
footer
node | func
You can override the default footer with your own custom component. This is useful if you want to provide a custom header and footer, while also enabling your Dialog's content to scroll. Footer can either be a React node or a function accepting `({ close })`.
hasCancel
bool
When true, the cancel button is shown.
hasClose
bool
When true, the close button is shown
onCloseComplete
func
Function that will be called when the exit transition is complete.
onOpenComplete
func
Function that will be called when the enter transition is complete.
onConfirm
func
Function that will be called when the confirm button is clicked. This does not close the Dialog. A close function will be passed as a paramater you can use to close the dialog. `onConfirm={(close) => close()}`
confirmLabel
string
Label of the confirm button.
isConfirmLoading
bool
When true, the confirm button is set to loading.
isConfirmDisabled
bool
When true, the confirm button is set to disabled.
onCancel
func
Function that will be called when the cancel button is clicked. This closes the Dialog by default. `onCancel={(close) => close()}`
cancelLabel
string
Label of the cancel button.
shouldAutoFocus
bool
Controls whether the overlay should automatically try to bring focus inside. @default true
shouldCloseOnOverlayClick
bool
Boolean indicating if clicking the overlay should close the overlay. @default true
shouldCloseOnEscapePress
bool
Boolean indicating if pressing the esc key should close the overlay. @default true
width
string | number
Width of the Dialog.
topOffset
string | number
The space above the dialog. This offset is also used at the bottom when there is not enough vertical space available on screen — and the dialog scrolls internally.
sideOffset
string | number
The space on the left/right sides of the dialog when there isn't enough horizontal space available on screen.
minHeightContent
string | number
The min height of the body content. Makes it less weird when only showing little content.
containerProps
object
Props that are passed to the dialog container.
contentContainerProps
object
Props that are passed to the content container.
preventBodyScrolling
bool
Whether or not to prevent scrolling in the outer body @default false
overlayProps
object
Props that are passed to the Overlay component.