Core Dynamic ComponentsReactModal Enterprise Wrapper

DynamicModal

DynamicModal wraps ReactModal with Ant Design theme tokens, smooth enter/leave fade animations, overlay dismiss controls, header action slots, and accessible ARIA attributes. Designed to host complex forms, audit logs, and detail views without clipping or z-index collisions.

Built-in smooth CSS fade-in and scale animations with closeTimeoutMS={200}
Accessible ARIA App binding for zero Next.js hydration issues
Header action slot for inline buttons, badges, or helper links next to the close button
Custom footer slot with sticky positioning and responsive padding
Configurable close mode: 'icon' (cross icon), 'text' ('Cancel'), or hidden close button
Customizable zIndex and bodyClassName for nested modals and overflow scrolling

Props & Configuration

10 props

Complete property specifications, parameter types, and default fallbacks.

PropertyTypeDefaultDescription
isOpenRequiredboolean—Controls modal visibility state.
onCloseRequired() => void—Callback triggered when clicking overlay, close icon, or pressing Escape key.
titleReact.ReactNode—Header title text or custom JSX node.
headerActionReact.ReactNode—Optional JSX rendered on the right side of the header next to the close icon.
footerReact.ReactNode—Modal footer content (e.g. Cancel and Save buttons).
close"icon" | "text""icon"Close button appearance: SVG cross icon or text link.
hideCloseButtonbooleanfalseHides the header close button entirely.
bodyClassNamestring—Custom CSS class applied to the scrollable modal body area.
headerClassNamestring—Custom CSS class applied to the modal header container.
zIndexnumber50Custom stacking z-index for nested overlays.

Interactive Examples & Live Previews

3 Demos

Every example includes its own live, interactive preview element alongside the corresponding copyable TypeScript snippet.

Example 1

Basic Controlled Modal

Standard modal dialog with title and default close icon.

Live Interactive Demo
DynamicModal.basic.tsxtsx
1import React, { useState } from "react";
2import { DynamicModal, ButtonField } from "antd-dynamic-ui";
3
4export default function BasicModalExample() {
5 const [isOpen, setIsOpen] = useState(false);
6
7 return (
8 <div className="p-4">
9 <ButtonField type="primary" onClick={() => setIsOpen(true)}>
10 Open Confirmation Modal
11 </ButtonField>
12
13 <DynamicModal
14 isOpen={isOpen}
15 onClose={() => setIsOpen(false)}
16 title="Notice"
17 >
18 <div className="py-4 text-sm text-[#5c4738]">
19 This action will export user profiles to the designated cold storage bucket.
20 </div>
21 </DynamicModal>
22 </div>
23 );
24}
Example 2

Complete Props with Header Action & Sticky Footer

Advanced modal with header action link, sticky footer buttons, body styling, and custom z-index.

Live Interactive Demo
DynamicModal.complete.tsxtsx
1import React, { useState } from "react";
2import { DynamicModal, ButtonField } from "antd-dynamic-ui";
3import { Tag } from "antd";
4import { ExternalLink } from "lucide-react";
5
6export default function CompleteModalExample() {
7 const [isOpen, setIsOpen] = useState(false);
8 const [isSaving, setIsSaving] = useState(false);
9
10 const handleSave = async () => {
11 setIsSaving(true);
12 await new Promise((r) => setTimeout(r, 1000));
13 setIsSaving(false);
14 setIsOpen(false);
15 };
16
17 return (
18 <div className="p-4">
19 <ButtonField type="primary" onClick={() => setIsOpen(true)}>
20 Inspect Security Permissions
21 </ButtonField>
22
23 <DynamicModal
24 isOpen={isOpen}
25 onClose={() => setIsOpen(false)}
26 title={
27 <div className="flex items-center gap-2">
28 <span>Security Policy #SEC-9021</span>
29 <Tag color="gold">Audited</Tag>
30 </div>
31 }
32 headerAction={
33 <a
34 href="https://docs.enterprise.io/security"
35 target="_blank"
36 rel="noreferrer"
37 className="flex items-center gap-1 text-xs text-blue-600 hover:underline"
38 >
39 <span>Policy Specs</span>
40 <ExternalLink size={12} />
41 </a>
42 }
43 footer={
44 <div className="flex justify-end gap-2 w-full">
45 <ButtonField type="default" onClick={() => setIsOpen(false)}>
46 Cancel
47 </ButtonField>
48 <ButtonField type="primary" loading={isSaving} onClick={handleSave}>
49 Apply Security Rules
50 </ButtonField>
51 </div>
52 }
53 close="icon"
54 zIndex={100}
55 bodyClassName="max-h-[60vh] overflow-y-auto space-y-3 p-6"
56 >
57 <p className="text-sm text-[#5c4738]">
58 Enforce multi-factor authentication (MFA) and biometric passkeys for all
59 administrative accounts in the engineering organization.
60 </p>
61 </DynamicModal>
62 </div>
63 );
64}
Example 3

Modal Hosting an Embedded DynamicForm

DynamicModal embedding a dynamic form that automatically validates and closes upon submission.

Live Interactive Demo
DynamicModal.withForm.tsxtsx
1import React, { useState } from "react";
2import { DynamicModal, DynamicForm, FormSchema, ButtonField } from "antd-dynamic-ui";
3import { message } from "antd";
4
5const editUserSchema: FormSchema = {
6 rows: [
7 [
8 { id: "displayName", type: "text", label: "Display Name", required: true, span: 12 },
9 { id: "department", type: "select", label: "Department", options: [{ key: "eng", value: "Engineering" }, { key: "sales", value: "Sales" }], span: 12 },
10 ]
11 ]
12};
13
14export default function ModalWithDynamicForm() {
15 const [isOpen, setIsOpen] = useState(false);
16
17 return (
18 <div className="p-4">
19 <ButtonField type="primary" onClick={() => setIsOpen(true)}>
20 Edit User Profile
21 </ButtonField>
22
23 <DynamicModal
24 isOpen={isOpen}
25 onClose={() => setIsOpen(false)}
26 title="Edit User Profile"
27 >
28 <DynamicForm
29 schema={editUserSchema}
30 initialValues={{ displayName: "Grace Hopper", department: "eng" }}
31 onSubmit={async (data) => {
32 message.success("Profile updated successfully!");
33 console.log("Updated data:", data);
34 setIsOpen(false);
35 }}
36 submitText="Update Profile"
37 />
38 </DynamicModal>
39 </div>
40 );
41}

Frequently Asked Questions & Quick Solutions

Architectural patterns, React 19 compatibility, and integration tips for DynamicModal.

How does DynamicModal integrate with Ant Design 5.x and Next.js 15?▼

DynamicModal is designed as an enhanced, declarative wrapper for Ant Design. It fully supports Next.js 15 App Router when using @ant-design/nextjs-registry, eliminating SSR hydration mismatches and guaranteeing 0ms layout thrashing.

Can I customize validation, themes, and props for DynamicModal?▼

Yes. Every prop is fully typed in TypeScript 5 with comprehensive Intellisense. You can pass custom styling via className or style props, configure global Ant Design themes via ConfigProvider, and extend validation logic seamlessly.