Use and Import

import Modal from 'nes-design/es/Modal';   OR   import { Modal } from 'nes-design';
Copy

Import Tips

NES.css does not include any JavaScript. If you want to use dialog element other than Chrome, you need polyfill.

官方未提供 dialog 的 polyfill,使用请注意浏览器兼容性。

Case

Modal Attr: round: false / theme:

This is Modal Body

Custom Modal

This is Modal Body

Props

Prop / 参数Description / 描述Type / 类型Default / 默认值
visiblemodal visibleboolean-
widthmodal widthnumber520
thememodal theme'dark'-
roundmodal shapeboolean-
cancelPropsmodal footer cancel button propsButtonProps-
okPropsmodal footer ok button propsButtonProps-
onCancelmodal click cancel callback(e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;-
onOkmodal click ok callback(e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;-
renderFootercustom footer(dialog: HTMLDialogElement) => React.ReactNode;-
childrencustom children(dialog: HTMLDialogElement) => React.ReactNode;-
...restmore attrsReact.DialogHTMLAttributes<HTMLDialogElement>;-