Modal
A dialog with a title, a scrollable body, and a footer.
When to use
Use Modal when you need a dialog with a title, a scrollable body, and a footer.
Import
TypeScript
import { Modal } from '@gzodo/ui'Modal opens over a blurred overlay. The header shows the title, an esc tag, and a close button. The footer holds optional content on the left and a Close button plus footer actions on the right. Focus is trapped, and Escape or an overlay click calls onClose when isDismissable is true. The dialog fades and scales over 200ms.
Examples
3Basic
Pass
isOpen and onClose. footer sits beside the default Close button. width sets the dialog size.Position
modalPosition is center, top, bottom, left, or right. Top keeps a 100px offset from the viewport edge.Footer
isShowFooterCancel={false} removes the stock Close button. footerLeft and footer fill the two sides.Modal
18Modal
Property
Description
Type
Default
isOpenRenders the dialog. Closing animates for 200ms before unmount.
boolean—
onCloseCalled from Close, Escape, the overlay, and the header button.
() => void—
titleHeader label. A string is muted text. A node is rendered as-is.
ReactNode'title'childrenScrollable body.
ReactNode—
footerActions on the right of the footer, after Close.
ReactNode—
footerLeftContent on the left of the footer.
ReactNode—
isShowFooterCancelShow the secondary Close button.
booleantruemodalPositionWhere the dialog sits inside the overlay.
'center' | 'top' | 'bottom' | 'left' | 'right''center'isDismissableAllow Escape and an overlay click to close.
booleantruewidthDialog width. A number is pixels.
string | number—
heightDialog and body height.
string | number—
minWidthMinimum dialog width.
string | number—
maxWidthMaximum dialog width.
string | number—
minHeightMinimum dialog height.
string | number—
maxHeightMaximum dialog height.
string | number—
fullWidthStretch the dialog to the overlay width.
boolean—
fullHeightStretch the dialog and the body to the overlay height.
boolean—
paddingPadding of the body. Overrides the default 8px.
string | number—