Nhảy tới nội dung

Modal

Properties

ModalActions

NameTypeDefaultDescription
textstring

Text hiển thị của action

highLightboolean

Nếu giá trị là true action sẽ có kiểu highlight

dangerboolean

Nếu giá trị là true action sẽ có kiểu danger

onClickfunction

Function sẽ được gọi khi click action

closeboolean

Action sau khi click sẽ close modal

disabledboolean

Disable action

NameTypeDefaultDescription
maskboolean

Hiển thị mask

afterClosefunction

Function được gọi sau khi modal đóng

onClosefunction

Function được gọi khhi modal đóng

maskClosableboolean

Có thể đóng modal khi click vào mask

visibleboolean

Hiển thị modal

titlestring

Title của modal

coverSrcstring

src của cover image

modalStyleReact.CSSProperties

Style modal

maskStyleReact.CSSProperties

Style mask

modalClassNamestring

Modal class name

maskClassNamestring

Mask class name

widthstring | number

Modal width

heightstring | number

Modal height

descriptionstring

Modal description

actionsModalActions

Modal actions list

actionsDividerboolean

Hiển thị divider giữa các action

zIndexnumber

Giá trị zindex của modal

Example

import React from "react";
import { Page, Button, Modal } from "zmp-ui";

function HomePage(props){
const [modalVisible, setModalVisible] = useState(false);
return (
<Page>
<Button onClick={() => {setModalVisible(true)}}>Open Modal</Button>
<Modal
visible={modalVisible}
title="ZaUI 2.0 Modal"
coverSrc={"https://images.unsplash.com/photo-1561336313-0bd5e0b27ec8"}
onClose={() => {
setModalVisible(false);
}}
zIndex={1200}
actions={[
{
text: "Button",
},
{
text: "Cancel",
close: true,
highLight: true,
},
]}
description="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged."
/>
</Page>
);
}