Skip to content
PixiKit

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
NameTypeDefaultDescription
triggerReactNodeNoneWhat the trigger button shows. Leave it out to open the dialog with `open` instead.
openbooleanNoneWhether the dialog is open, when you hold the state.
defaultOpenbooleanNoneWhether the dialog is open at first, when the dialog holds the state.
onOpenChange(open: boolean) => voidNoneCalled with the next open state.
titlestringNoneThe heading; it names the dialog for screen readers.
descriptionstringNoneA line under the title; it describes the dialog for screen readers.
childrenReactNodeNoneThe body content.
footerReactNodeNoneThe 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.
iconReactNodeNoneAn icon shown in a round badge before the title.
showClosebooleantrueShows a close button in the corner.
closeOnBackdropbooleantrueCloses the dialog when the backdrop is clicked.
initialFocusRefObject<HTMLElement | null>NoneThe element to focus when it opens; default is the first tabbable.
sheetOnMobilebooleantrueDocks to the bottom edge as a sheet with stacked, full-width footer buttons when its container is narrower than 480px.
portalbooleantrueRenders in a portal on the page body and locks page scroll; turn off to fill the nearest positioned parent instead.
classNamestringNoneExtra classes for the dialog panel.

More interaction components in Pro

View all

Related