ComponentsDialogs
DialogContainer
Features
- Accessible modal implementation
- Customizable overlay and content styling
- Close button with warning support
- Keyboard navigation support
- Customizable animations
- Responsive design
Structure
The DialogContainer is composed of three main parts:
- Header - Contains the title and optional subtitle
- Content Area - The main content section where children are rendered
- Footer - Optional section for actions like buttons or additional information
Styling
The component comes with default styling that includes:
- Responsive width and height constraints
- Drop shadow and rounded corners
- Overlay with backdrop blur
- Dark mode support
- Customizable through
className
andcontentClassName
props
Usage
Basic Example
Input Result:
Props
Prop | Type | Default | Description |
---|---|---|---|
isOpen | boolean | - | Controls the open state of the dialog |
onOpenChange | (value: boolean) => void | - | Callback when the open state changes |
title | string | - | The title of the dialog |
subTitle | string | - | Optional subtitle for the dialog |
footer | ReactNode | - | Optional footer content |
className | string | - | Additional classes for the dialog container |
contentClassName | string | - | Additional classes for the dialog content |
preventAutoFocus | boolean | true | Whether to prevent auto-focus on open |
children | ReactNode | - | The content to display in the dialog |
Accessibility
The DialogContainer implements the following accessibility features:
- Manages focus trap within the dialog
- Supports keyboard navigation (Esc to close)
- Proper ARIA attributes for screen readers
- Focus management can be controlled via
preventAutoFocus