Dialog
A centred modal with a fading backdrop. It traps focus, locks page scroll, returns focus on close, and docks to the bottom as a sheet when its container is narrow.
pixikit.com/docs/components/dialog
Customize
Default open
Size
Tone
Show close
Close on backdrop
Sheet on mobile
Portal
Props
17| Name | Type | Default | Description |
|---|---|---|---|
trigger | ReactNode | None | What the trigger button shows. Leave it out to open the dialog with `open` instead. |
open | boolean | None | Whether the dialog is open, when you hold the state. |
defaultOpen | boolean | None | Whether the dialog is open at first, when the dialog holds the state. |
onOpenChange | (open: boolean) => void | None | Called with the next open state. |
title | string | None | The heading; it names the dialog for screen readers. |
description | string | None | A line under the title; it describes the dialog for screen readers. |
children | ReactNode | None | The body content. |
footer | ReactNode | None | The buttons at the bottom. The first tabbable element gets focus when it opens, so put Cancel first. |
size | "sm" | "md" | "lg" | "md" | The widest the dialog grows. |
tone | "default" | "danger" | "default" | `danger` uses role alertdialog and tints the icon. |
icon | ReactNode | None | An icon shown in a round badge before the title. |
showClose | boolean | true | Shows a close button in the corner. |
closeOnBackdrop | boolean | true | Closes the dialog when the backdrop is clicked. |
initialFocus | RefObject<HTMLElement | null> | None | The element to focus when it opens; default is the first tabbable. |
sheetOnMobile | boolean | true | Docks to the bottom edge as a sheet with stacked, full-width footer buttons when its container is narrower than 480px. |
portal | boolean | true | Renders in a portal on the page body and locks page scroll; turn off to fill the nearest positioned parent instead. |
className | string | None | Extra classes for the dialog panel. |