Skip to content

Dialog ​

catnip-dialog renders a modal dialog using the native <dialog> element with Catnip header, body, and footer structure. Use it for focused decisions, confirmations, short forms, and interruptive flows that must temporarily block the page behind it.

The prop-based header supports dialogTitle, description, icon, and semantic icon intent. Set layout="centered" to center the generated header, body content, and footer action group. Put actions in the footer slot; replace the header with the header slot when you need custom structure. padding="none" removes the default surface inset; --catnip-dialog-padding sets a custom length. --catnip-dialog-width overrides the t-shirt size (including max-content to hug content).

catnip-dialog is controlled by open. Close actions emit close-dialog and update:open, but the dialog stays open until the consumer updates open to false.

Live example ​

Guidelines ​

Composition ​

Use props for the standard header: icon, dialogTitle, and description. Use the header slot when that section needs custom structure. Put actions in the footer slot as catnip-button (or other controls); Dialog does not generate footer buttons. Do not pass header props together with the header slot; development builds warn because those props are ignored.

Use layout="centered" for the centered composition. It centers the generated header, body content, and footer action group. Dialog positions the group but does not change the size or minimum width of slotted buttons; use size="m" for footer buttons in the default layout and size="l" in the centered layout. Use intent to give the generated icon its semantic color treatment.

Keep the default surface padding for copy and forms. Use padding="none" when the body is edge-to-edge (media, a custom chrome). For a length that is not the default inset, set --catnip-dialog-padding on the host.

Catnip overlays inside the dialog (Tooltip, Dropdown, Date, Phone country list, Tabs overflow menu) teleport into the open <dialog> — not document.body. Modal showModal() makes everything outside that subtree inert, so a body portal cannot paint or receive pointer events above the dialog.

Use size for the usual widths. For a one-off width, or to hug content, set --catnip-dialog-width on the host (720px, max-content, and so on). See Specs — Width.

Dismissal ​

Treat open as the source of truth. Generated close, Escape, and backdrop paths only request dismissal by emitting close-dialog and update:open=false; consumers close the dialog by updating open to false. Slotted footer actions are consumer-owned and should update open directly when their work permits closing.

Keep at least one obvious dismissal route for ordinary dialogs: close button, a footer action, Escape, or backdrop close when appropriate. Backdrop close is off by default so destructive confirmations and forms do not disappear from accidental pointer input.

Use closable=false when users must not dismiss the dialog accidentally or before completing a required decision. In that mode, Escape is disabled and backdrop clicks only emit backdrop-click; they do not request dismissal, even if closeOnBackdropClick=true.

With closable=false, consumers decide whether users get an explicit dismissal route. Show the header close button with showCloseButton=true, provide a footer action that updates open, or close the dialog programmatically from the submit flow.

Catnip Design System by Signicat