Skip to content

Dialog ​

Props ​

PropTypeDefaultOptionsDescription
openbooleanfalse—Controls whether the dialog is open
size"s" | "m" | "l""m"s, m, lDialog width: 492px, 664px, 836px. Override with --catnip-dialog-width.
paddingstring"default"default, noneSurface inset. none removes it. Override with --catnip-dialog-padding for a custom length.
layout"default" | "centered""default"default, centeredControls alignment of the generated header, body content, and footer actions
dialogRolestring"dialog"dialog, alertdialogARIA role
dialogTitlestring""—Header title; ignored when the header slot is used
descriptionstring""—Header description; ignored when the header slot is used
iconCatnipIconName | """"Valid CatnipIconNameHeader icon; ignored when the header slot is used
iconSizenumber32 default / 40 centered—Header icon size in px; an explicit value overrides the layout default
intentstring"brand"informative, success, warning, danger, brandSemantic color treatment for the generated header icon
showCloseButtonbooleantrue—Shows the header close button
backdropBlurbooleanfalse—Adds blur to the backdrop
closeOnBackdropClickbooleanfalse—Requests dismissal after a backdrop click only when closable is also true
closablebooleantrue—Allows implicit dismissal requests through Escape and backdrop clicks
dialogAriaLabelstring""—Accessible name override
ariaLabelledbystring""—ID of the labelling element
ariaDescribedbystring""—ID of the describing element
closeButtonAriaLabelstring"Close dialog"—Accessible name for the icon-only close button
testSelectorsTestSelectorsPropSee Test Selectors—Overrides stable data-test values.

Slots ​

NameDescription
headerCustom header content. Header props are ignored when this slot has content.
(default)Dialog body. Rendered only while the dialog is open.
footerFooter actions. Consumers own buttons, hierarchy, and whether an action updates open.

Events ​

EventDescription
update:openEmitted with false when the dialog requests dismissal; consumers must update open
close-dialogEmitted when close button, Escape, backdrop, or native close requests dismissal
backdrop-clickEmitted whenever the backdrop is clicked
after-dialog-closeEmitted after the dialog is closed and removed from the rendered tree

catnip-dialog is controlled by open. Dismissal actions emit close-dialog and update:open=false, but the dialog remains visible until the consumer updates open to false.

Use layout="centered" when the dialog's generated header, body copy, and footer actions should be centered.

When closable=false, Escape never requests dismissal and backdrop clicks only emit backdrop-click, even when closeOnBackdropClick=true. Users can still request dismissal through the generated header close button when showCloseButton=true. Footer actions are consumer-owned and should update open directly. If neither an explicit close control nor a footer action is available, consumers must close the dialog programmatically.

Width ​

The predefined size widths are s = 492px, m = 664px, and l = 836px. Set --catnip-dialog-width on the host to override the selected desktop size. The effective width is capped at the viewport.

css
catnip-dialog {
  --catnip-dialog-width: 720px;
}

To hug content instead of a t-shirt size, set the same variable to max-content (still capped at the viewport):

css
catnip-dialog {
  --catnip-dialog-width: max-content;
}

At the mobile breakpoint the surface always uses the near-full viewport width, including when a custom width is set.

Padding ​

Default surface padding is 40px (--catnip-space-10), 24px below 560px. Set padding="none" to remove it. For a custom inset, set --catnip-dialog-padding on the host (same pattern as the width override):

css
catnip-dialog {
  --catnip-dialog-padding: 16px;
}

Test Selectors ​

AttributeDefault Value
rootcatnip-dialog
surfacecatnip-dialog-surface
headercatnip-dialog-header
iconcatnip-dialog-icon
titlecatnip-dialog-title
descriptioncatnip-dialog-description
bodycatnip-dialog-body
footercatnip-dialog-footer
closeButtoncatnip-dialog-close

Catnip Design System by Signicat