Skip to main content
Version: latest
Works everywhere

Dialog works in both server and client environments. Always use the standard import (e.g. @prokodo/ui/dialog) — the library detects the runtime automatically.

Dialog

Dialog renders an accessible modal overlay. Focus is trapped inside while open; pressing Escape closes it. Supports multiple size variants and an optional close button.

Live demo →

Overview

import { Dialog } from "@prokodo/ui/dialog"
;<Dialog
open={isOpen}
title="Confirm action"
onChange={(e, reason, state) => setIsOpen(state)}
>
<p>Are you sure you want to delete this item?</p>
</Dialog>

Import

import { Dialog } from "@prokodo/ui/dialog"

CSS:

import "@prokodo/ui/dialog.css"

Props

PropTypeDefaultRequiredDescription
openbooleanControls dialog visibility.
titlestringDialog title text.
titlePropsHeadlinePropsProps forwarded to the title Headline component.
hideTitlebooleanfalseVisually hide the title (still accessible).
hideCloseButtonbooleanfalseHide the default close button.
heightnumber | stringFixed height for the dialog content area.
fullScreenbooleanfalseRender dialog as full-screen overlay.
scroll"paper" | "body""paper"Scroll behaviour: "paper" scrolls content inside dialog; "body" scrolls the page.
closeOnBackdropClickbooleantrueClose when clicking the backdrop.
actionsDialogAction[]Action buttons rendered in the dialog footer.
renderHeader() => ReactNodeCustom header render function.
contentPropsobjectProps forwarded to the content wrapper element.
wrapperPropsobjectProps forwarded to the outer dialog wrapper.
translationsDialogTranslationsOverride default label strings (close button, etc.).
onClose() => voidClose button click handler.
onChange(event: unknown, reason: "backdropClick" | "escapeKeyDown", state: boolean) => voidCalled on any open-state change with reason and new state.
refRef<DialogRef>Imperative ref for programmatic openDialog / closeDialog control.
classNamestringCSS class on root element.

See src/components/dialog/Dialog.model.ts for the full DialogProps type.


Design Tokens

Customise Dialog via CSS custom properties on :root or a scoped ancestor.

TokenDefaultDescription
--pk-dialog-bgvar(--pk-color-surface)Dialog background
--pk-dialog-fgvar(--pk-color-fg)Dialog text color
--pk-dialog-radiusvar(--pk-radius-md)Dialog border-radius
--pk-dialog-shadowvar(--pk-shadow-lg)Dialog box-shadow
--pk-dialog-padding-xvar(--pk-space-lg)Horizontal padding
--pk-dialog-padding-yvar(--pk-space-xl)Vertical padding
--pk-dialog-header-fgvar(--pk-color-fg)Header text color
--pk-dialog-close-fgvar(--pk-palette-grey-500)Close button icon color

--pk-z-modal (1301) and --pk-z-modal-backdrop (1300) are global semantic tokens that control Dialog stacking and can be overridden on :root.

AIC Note

Use the standard import path in application code:

import { Dialog } from "@prokodo/ui/dialog"

No separate /client or /lazy import selection is required in consumer code.

AIC components also support a priority flag for critical above-the-fold elements. This is most visible on Image (native preloading via <link rel="preload"> for above-the-fold content).


WCAG 2.2 Status

CriterionNameStatusNote
1.3.1Info and Relationships (A)✅ FulfilledSemantic structure (headings, lists, labels, landmarks) must be conveyed programmatically via HTML or ARIA.
2.1.1Keyboard (A)✅ FulfilledAll functionality must be operable via keyboard alone, without requiring specific timing.
2.1.2No Keyboard Trap (A)🔍 Manual reviewKeyboard focus must never become trapped inside a component; users must always be able to navigate away using standard keys.
2.4.3Focus Order (A)🔍 Manual reviewThe keyboard focus sequence must preserve meaning and operability in the complete page integration context.
2.4.7Focus Visible (AA)🔍 Manual reviewA visible keyboard focus indicator must be present on every interactive element. Verify against the applied product theme.
2.4.11Focus Not Obscured (Min.) (AA)🔍 Manual reviewThe focused component must not be fully hidden by sticky headers, overlays, or other positioned page elements.
4.1.2Name, Role, Value (A)✅ FulfilledName, role, and state of all interactive UI components must be programmatically determinable via native HTML semantics or ARIA.
4.1.3Status Messages (AA)🔍 Manual reviewStatus messages (loading, success, error, progress) must reach assistive technologies without a focus change (aria-live or role='status').

Test coverage: 1 jest-axe assertion(s) across 4 test file(s) · 7 ARIA attribute occurrence(s) in source scan. Criteria marked 🔍 require manual verification in the final product integration and theme context.

Storybook

👉 Open Dialog in Storybook


Source

src/components/dialog/Dialog.model.ts