BenixBenix DSv1.1.0

Dialog

Generic modal built on Radix. Body padding is built-in — pass children without extra wrappers.

Examples

Basic

const [open, setOpen] = useState(false);
<Dialog
open={open}
onOpenChange={setOpen}
onClose={() => setOpen(false)}
title="Confirmation"
description="You're about to perform an important action."
footer={
<>
<Button variant="outline" onClick={() => setOpen(false)}>Cancel</Button>
<Button onClick={() => setOpen(false)}>Confirm</Button>
</>
}
>
<p className="text-sm text-muted-foreground">
Free-form body content.
</p>
</Dialog>

No close button, no overlay click

Use when the user must take an explicit action.

<Dialog
open={open}
showCloseButton={false}
closeOnOverlayClick={false}
title="Important"
footer={<Button>Got it</Button>}
>
...
</Dialog>

API Reference

Props of the Dialog component.

PropTypeDefaultDescription
open*boolean
onOpenChange(open: boolean) => void
onClose() => void
titlestring
descriptionstring
iconReactNodeIcon shown next to the title.
footerReactNodeRight-aligned footer (typically action buttons).
maxWidthstring'800px'
closeOnOverlayClickbooleanfalse
closeOnEscapebooleantrue
showCloseButtonbooleantrue
zIndexnumberOverride z-index when stacking with drawers.