Overview
Modal is a flexible dialog component that supports three distinct display types: default centered modal, structured form layout, and embedded web content. It provides smooth animations, customizable headers, and responsive layouts.Basic Usage
Modal Types
Default Modal
Standard centered modal with custom content.Form Modal
Structured layout for form fields with label-value pairs.Web Modal
Embeds external web content in an iframe.Full Screen Modal
Expands from bottom of screen, useful for mobile-first designs.Lateral Modal
Slides in from the right side, ideal for side panels and settings.Props
Controls modal visibility. When
true, modal is displayed with animation.Callback fired when modal should close (X button, overlay click if enabled).
Display mode of the modal:
default: Centered modal with scale animationfull-screen: Slides up from bottomform: Centered with structured form layoutweb: Centered with embedded iframelateral: Slides in from right side
Main heading displayed in the modal header.
Secondary text displayed below the title.
Error message displayed in a red banner above the footer.
Form field configurations for
type="form". Each item creates a labeled row:External URL to display in iframe when
type="web".Props for the primary action button in the footer. If provided, button is displayed.
When
true, hides the X close button in the top-right corner.When
true, hides the entire header section (title, subtitle, Header).When
true, clicking the backdrop closes the modal.Opacity of the backdrop overlay (0-1).
Custom styles applied to the modal container.
Custom styles for the header section.
Custom styles for the children content wrapper.
Custom styles for the footer section.
Custom React element rendered in the header area, after title/subtitle.
Custom React element rendered in the footer, before the button.
Ref Methods
Modal supports ref forwarding with the following methods:Programmatically closes the modal with animation.
Advanced Examples
Modal with Custom Header and Footer
Modal with Error Handling
Controlled Modal with Ref
Styling Notes
- Form modal automatically sizes to
80%width with max600px - Web modal fills height and removes content padding
- Full-screen modal animates from bottom with slide-up effect
- Lateral modal is
400pxwide on desktop, full width on mobile - All animations use
0.3s ease-outtransitions - Backdrop uses smooth opacity transition
Accessibility
- Modal uses
react-modalinternally for accessibility features - Focus is trapped within the modal when open
- ESC key closes modal by default
- Overlay click can be enabled with
shouldCloseOnOverlayClick - Close button is keyboard accessible