diff --git a/docs/documentation/components/dialog.mdx b/docs/documentation/components/dialog.mdx index a144e1b2f..7f985298c 100644 --- a/docs/documentation/components/dialog.mdx +++ b/docs/documentation/components/dialog.mdx @@ -209,3 +209,30 @@ function PreserveBodyScrollingDialogExample() { ) } ``` + +## Handle overlay/close clicks + +Use the `onBeforeClose` prop to handle overlay/close clicks. It is executed +when dialog is about to close. Return `false` to prevent the sheet from closing. + +```jsx +function OnBeforeCloseExample() { + const [isShown, setIsShown] = React.useState(false) + + return ( + + confirm('Are you sure you want to close?')} + onCloseComplete={hide} + > + onBeforeClose: are you sure you want to close? + + + + )} + + + ))