avatar
UI
Components
Changelog
LobeHub UI
Antd Components
Lucide Icons
CSSinJS
Ctrl
K
Chat
ChatInputArea
ChatItem
EditableMessage
Data Display
Card
ChatMarkdown
CollapseGroup
Descriptions
Highlighter
JsonViewer
LogViewer
ProCard
RichTextEditor
Status
Table
Tree
Data Entry
CodeEditor
Form
Mentions
MonacoEditor
SelectCard
SliderInput
Feedback
Alert
DragPanel
Drawer
Modal
Notification
General
Breadcrumb
Typography
WaveformIcon
Layout
Divider
Page
Navigation
ButtonGroup
Dropdown
Theme
ConfigProvider
Logo
TTS
useSpeechSynthes
Utils
FormHelper

Modal

Display a modal dialog box, providing a title, content area, and action buttons.

import { Modal } from '@yuntijs/ui';
NPM
UNPKG
BundlePhobia
PackagePhobia
Anvaka Graph
Source
Edit
Previous
Drawer
Next
Notification

Resources

Lobe UI-AIGC Components
Lobe Icon-AI / LLM Icon Collection
Lobe Charts-Modern Charts
Lobe TTS-TTS / STT Library

Community

Report Bug
Request Feature

Help

GitHub
Changelog

More Products

🤯 Lobe Chat-AI / LLM Chat Framework
🧸 Lobe Vidol-Virtual Idols for EveryOne
🅰️ Lobe Theme-Stable Diffusion Extension
🌐 Lobe i18n-AI i18next CLI
Copyright © 2022-2026
Made with ☁️ by YuntiJS
LobeHub

Usage

based on antd Modal component.

Simple usage

JSX
import { useState } from 'react';

export default () => {
  const [open, setOpen] = useState < boolean > false;
  const [confirmLoading, setConfirmLoading] = useState < boolean > false;
  return (
    <>
      <Button
        onClick={() => {
          setOpen(true);
        }}
      >
        Open Modal
      </Button>
      <Modal
        title="YuntiUI Modal"
        open={open}
        confirmLoading={confirmLoading}
        onCancel={() => setOpen(false)}
        onOk={() => {
          setConfirmLoading(true);
        }}
      >
        The YuntiUI components are inspired by LobeUI and developed based on Antd components, fully
        compatible with Antd components, and it is recommended to use antd-style as the default
        css-in-js styling solution.
      </Modal>
    </>
  );
};

Modal.method usage

Playground

APIs

NameDescriptionTypeDefault
openWhether the modal dialog is visible or notboolean--
confirmLoadingWhether to apply loading visual effect for OK button or notboolean--
titleThe modal dialog's titleReactNode--
onOkSpecify a function that will be called when a user clicks the OK button(e:React.MouseEvent<HTMLButtonElement, MouseEvent>)=>void--
onCancelSpecify a function that will be called when a user clicks mask, close button on top right or Cancel button(e:React.MouseEvent<HTMLButtonElement, MouseEvent>)=>void--
afterClose--()=>void--
afterOpenChangeCallback when the animation ends when Modal is turned on and off(open:boolean)=>void--
centeredCentered Modalboolean--
widthWidth of the modal dialogstring|number|Partial___type--
okTextText of the OK buttonReactNode--
okTypeButton `type` of the OK button"default"|"link"|"text"|"primary"|"dashed"|"danger"--
cancelTextText of the Cancel buttonReactNode--
maskClosableWhether to close the modal dialog when the mask (area outside the modal) is clickedboolean--
forceRenderForce render Modalboolean--
okButtonProps--unknown--
cancelButtonProps--unknown--
destroyOnClose--boolean--
destroyOnHidden--boolean--
style--{}--
wrapClassName--string--
maskTransitionName--string--
transitionName--string--
className--string--
rootClassName--string--
classNames--any--
getContainer--string|HTMLElement|getContainerFunc|--
zIndex--number--
bodyStyle--{}--
maskStyle--{}--
mask--boolean--
keyboard--boolean--
wrapProps--any--
prefixCls--string--
closeIcon--ReactNode--
modalRender--(node:React.ReactNode)=>|string|number|unknown|ReactElement|unknown|ReactPortal|Promise<AwaitedReactNode>|boolean--
focusTriggerAfterClose--boolean--
children--ReactNode--
mousePosition--|{x:number;y:number}--
visible--boolean--
loading--boolean--
footer--ReactNode|(originNode:React.ReactNode,extra:{ OkBtn: React.FC<{}>; CancelBtn: React.FC<{}>; })=>|string|number|unknown|ReactElement|unknown|ReactPortal|Promise<AwaitedReactNode>|boolean--