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. 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).
Prop Type Default Description children* ReactNode - Header content, typically DialogTitle and DialogDescription. classNamestring - Additional CSS class for the header wrapper.
DialogTitle
Prop Type Default Description children* ReactNode - Title text content. classNamestring - Additional CSS class for the title element.
DialogDescription
Prop Type Default Description children* ReactNode - Description text content. classNamestring - Additional CSS class for the description element.
Prop Type Default Description children* ReactNode - Footer content, typically action buttons. classNamestring - Additional CSS class for the footer wrapper.