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
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
| Prop | Type | Default | Description |
|---|
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. |
className | string | - | Additional CSS class for the dialog panel. |
aria-labelledby | string | - | ID of the element that labels the dialog (should match a DialogTitle id). |
aria-describedby | string | - | ID of the element that describes the dialog (should match a DialogDescription id). |
| Prop | Type | Default | Description |
|---|
children* | ReactNode | - | Header content, typically DialogTitle and DialogDescription. |
className | string | - | Additional CSS class for the header wrapper. |
DialogTitle
| Prop | Type | Default | Description |
|---|
children* | ReactNode | - | Title text content. |
className | string | - | Additional CSS class for the title element. |
DialogDescription
| Prop | Type | Default | Description |
|---|
children* | ReactNode | - | Description text content. |
className | string | - | Additional CSS class for the description element. |
| Prop | Type | Default | Description |
|---|
children* | ReactNode | - | Footer content, typically action buttons. |
className | string | - | Additional CSS class for the footer wrapper. |