Dialog
Dialog renders a modal overlay with role="dialog", aria-modal="true", focus trapping, backdrop click, and escape key handling.
Basic Usage
Dialog Title
Content here.
import { Dialog, DialogHeader, DialogBody, DialogFooter } from "@paramanu/overlays-react"
export default function App() {return ( <Dialog open onClose={() => {}} size="md"> <DialogHeader>Dialog Title</DialogHeader> <DialogBody>Content here.</DialogBody> <DialogFooter><button>Close</button></DialogFooter> </Dialog>)}<div class="pm-dialog pm-dialog--md" role="dialog" aria-modal="true"><div class="pm-dialog__header">Dialog Title</div><div class="pm-dialog__body">Content here.</div><div class="pm-dialog__footer"><button>Close</button></div></div>Accessibility
- Uses
role="dialog"andaria-modal="true". - Focus is trapped within the dialog when open.
- Pressing Escape closes the dialog by default.
- Title is linked via
aria-labelledby.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
open | boolean | false | Whether the dialog is visible |
onClose | () => void | - | Close callback |
size | "xs" | "sm" | "md" | "lg" | "xl" | "full" | "md" | Panel max-width |
centered | boolean | false | Vertically center |
scrollBehavior | "inside" | "outside" | "outside" | Scroll position |
closeOnBackdropClick | boolean | true | Close on backdrop click |
closeOnEscape | boolean | true | Close on Escape key |