Dialog
freeDialog creates a focused modal step for confirmations and short tasks.
Installation
Add this component with the NateUI CLI.
Examples
Basic
Size
Custom Backdrop
Internal Scroll
Custom Layout
Closable
Lock Scroll
API
Dialog accepts the props below plus native props for the dialog content div.
| Prop | Description | Type | Default |
|---|---|---|---|
children | Modal content rendered inside the dialog surface. | ReactNode | - |
className | Class names applied to the dialog content surface. | string | - |
closable | Shows the default close button in the top corner. | boolean | true |
height | Fixed height applied to the dialog content surface. | string | number | - |
isOpen | Controls whether the dialog is visible. | boolean | false |
lockScroll | Locks document scrolling through the overlay while the dialog is mounted. | boolean | false |
onClose | Called when the dialog asks to close through the close button, overlay, or Escape key. Update isOpen in this handler. | DialogOpenChangeHandler | - |
onOpen | Called when the floating layer reports that the dialog opened. | DialogOpenChangeHandler | - |
overlayClassName | Class names applied to the overlay element. | string | - |
ref | Ref forwarded to the dialog content element. | Ref<HTMLDivElement> | - |
shouldCloseOnEsc | Allows Escape to request closing the dialog. | boolean | true |
shouldCloseOnOverlayClick | Allows an overlay click to request closing the dialog. | boolean | true |
width | Width of the dialog in pixels. Falls back to auto width when the viewport is narrower. | number | 520 |
...nativeDivProps | Native props applied to the dialog content element. | NativeDialogDivProps | - |