diff --git a/components/modal/ConfirmDialog.tsx b/components/modal/ConfirmDialog.tsx
index 2d4e9890be0a..5e4302d7514a 100644
--- a/components/modal/ConfirmDialog.tsx
+++ b/components/modal/ConfirmDialog.tsx
@@ -41,7 +41,7 @@ export function ConfirmContent(
rootPrefixCls,
type,
okCancel,
-
+ footer,
// Legacy for static function usage
locale: staticLocale,
} = props;
@@ -107,19 +107,23 @@ export function ConfirmContent(
)}
{props.content}
-
- {cancelButton}
-
- {okText || (mergedOkCancel ? mergedLocale?.okText : mergedLocale?.justOkText)}
-
-
+ {footer !== undefined ? (
+ footer
+ ) : (
+
+ {cancelButton}
+
+ {okText || (mergedOkCancel ? mergedLocale?.okText : mergedLocale?.justOkText)}
+
+
+ )}
);
}}
diff --git a/components/modal/Modal.tsx b/components/modal/Modal.tsx
index e0962de51c0f..98898e8f7228 100644
--- a/components/modal/Modal.tsx
+++ b/components/modal/Modal.tsx
@@ -131,6 +131,7 @@ export interface ModalFuncProps {
direction?: DirectionType;
bodyStyle?: React.CSSProperties;
closeIcon?: React.ReactNode;
+ footer?: React.ReactNode;
modalRender?: (node: React.ReactNode) => React.ReactNode;
focusTriggerAfterClose?: boolean;
}
diff --git a/components/modal/__tests__/confirm.test.tsx b/components/modal/__tests__/confirm.test.tsx
index 67a688e2b1db..a33852be0c34 100644
--- a/components/modal/__tests__/confirm.test.tsx
+++ b/components/modal/__tests__/confirm.test.tsx
@@ -703,4 +703,28 @@ describe('Modal.confirm triggers callbacks correctly', () => {
jest.useRealTimers();
errSpy.mockRestore();
});
+
+ it('null of Footer', async () => {
+ Modal.confirm({
+ footer: null,
+ });
+
+ await waitFakeTimer();
+
+ expect($$('.ant-modal-confirm-btns')).toHaveLength(0);
+ });
+
+ it('Update Footer', async () => {
+ Modal.confirm({
+ footer: (
+
+
+
+ ),
+ });
+ await waitFakeTimer();
+ expect($$('.custom-modal-footer')).toHaveLength(1);
+ });
});
diff --git a/components/modal/index.en-US.md b/components/modal/index.en-US.md
index 5c9f5379302f..78482fbad2d5 100644
--- a/components/modal/index.en-US.md
+++ b/components/modal/index.en-US.md
@@ -98,6 +98,7 @@ The items listed above are all functions, expecting a settings object as paramet
| closable | Whether a close (x) button is visible on top right of the confirm dialog or not | boolean | false | 4.9.0 |
| closeIcon | Custom close icon | ReactNode | undefined | 4.9.0 |
| content | Content | ReactNode | - | |
+| footer | Footer content, set as `footer: null` when you don't need default buttons | ReactNode | - | 5.1.0 |
| getContainer | Return the mount node for Modal | HTMLElement \| () => HTMLElement \| Selectors \| false | document.body | |
| icon | Custom icon | ReactNode | <QuestionCircle /> | |
| keyboard | Whether support press esc to close | boolean | true | |
diff --git a/components/modal/index.zh-CN.md b/components/modal/index.zh-CN.md
index 36cb3a5e84ec..da5f803a5340 100644
--- a/components/modal/index.zh-CN.md
+++ b/components/modal/index.zh-CN.md
@@ -101,6 +101,7 @@ demo:
| closable | 是否显示右上角的关闭按钮 | boolean | false | 4.9.0 |
| closeIcon | 自定义关闭图标 | ReactNode | undefined | 4.9.0 |
| content | 内容 | ReactNode | - | |
+| footer | 底部内容,当不需要默认底部按钮时,可以设为 `footer: null` | ReactNode | - | 5.1.0 |
| getContainer | 指定 Modal 挂载的 HTML 节点, false 为挂载在当前 dom | HTMLElement \| () => HTMLElement \| Selectors \| false | document.body | |
| icon | 自定义图标 | ReactNode | <QuestionCircle /> | |
| keyboard | 是否支持键盘 esc 关闭 | boolean | true | |