Dialog

An accessible modal dialog component with backdrop overlay, focus trapping, and Escape key dismissal. Uses compound sub-components for structured header, title, description, and footer sections.

Import

import {
  Dialog,
  DialogHeader,
  DialogTitle,
  DialogDescription,
  DialogFooter,
} from '@wavebooking/aqua-fusion';

Preview

Loading preview...

Usage

const [open, setOpen] = useState(false);

<>
  <Button onClick={() => setOpen(true)}>Open Dialog</Button>
  <Dialog open={open} onClose={() => setOpen(false)}>
    <DialogHeader>
      <DialogTitle>Confirm Action</DialogTitle>
      <DialogDescription>
        Are you sure you want to proceed? This action cannot be undone.
      </DialogDescription>
    </DialogHeader>
    <DialogFooter>
      <Button variant="outline" onClick={() => setOpen(false)}>Cancel</Button>
      <Button onClick={() => setOpen(false)}>Confirm</Button>
    </DialogFooter>
  </Dialog>
</>

Props

Dialog

PropTypeDefaultDescription
open*boolean-Whether the dialog is visible.
onClose*() => void-Callback when the dialog should close (backdrop click, Escape key).
children*ReactNode-Dialog content, typically composed of DialogHeader and DialogFooter.
classNamestring-Additional CSS class for the dialog panel.
aria-labelledbystring-ID of the element that labels the dialog (should match a DialogTitle id).
aria-describedbystring-ID of the element that describes the dialog (should match a DialogDescription id).

DialogHeader

PropTypeDefaultDescription
children*ReactNode-Header content, typically DialogTitle and DialogDescription.
classNamestring-Additional CSS class for the header wrapper.

DialogTitle

PropTypeDefaultDescription
children*ReactNode-Title text content.
classNamestring-Additional CSS class for the title element.

DialogDescription

PropTypeDefaultDescription
children*ReactNode-Description text content.
classNamestring-Additional CSS class for the description element.

DialogFooter

PropTypeDefaultDescription
children*ReactNode-Footer content, typically action buttons.
classNamestring-Additional CSS class for the footer wrapper.