Sheet
Page component: Component wrapper nội dung trang
Properties
Sheet
Name | Type | Default | Description |
---|---|---|---|
mask | boolean | Hiển thị mask khi show sheet | |
afterClose | function | Function gọi sai khi close sheet | |
onClose | function | Function gọi khi close sheet | |
maskClosable | boolean | Đóng sheet khi click bào mask | |
visible | boolean | Hiển thị sheet | |
title | string | Title của sheet | |
modalStyle | React.CSSProperties | Style modal | |
maskStyle | React.CSSProperties | Style mask | |
modalClassName | string | Modal class name | |
maskClassName | string | Mask class name | |
width | string | number | Sheet width | |
height | string | number | Sheet height | |
description | string | Sheet description | |
children | React.ReactNode | Nội dung sheet | |
zIndex | number | Giá trị z-index của modal | |
handler | boolean | Sheet handler | |
autoHeight | boolean | false | Chiều cao của sheet ôm theo content |
ActionButton
Name | Type | Default | Description |
---|---|---|---|
highLight | boolean | Nếu giá trị là | |
danger | boolean | Nếu giá trị là | |
onClick | function | Function sẽ được gọi khi click action | |
close | boolean | Action sau khi click sẽ close modal | |
disabled | boolean | Disable action |
Sheet.Action
Name | Type | Default | Description |
---|---|---|---|
divider | boolean | Có divider giữa các action | |
actions | Array.ActionButton | Danh sách các action | |
groupDivider | boolean | Có divider giữa các group action |
Example
import React from "react";
import { Page, Button, Sheet } from "zmp-ui";
function HomePage(props){
const [sheetVisible, setSheetVisible] = useState(false);
return (
<Page>
<Button onClick={() => {setSheetVisible(true)}}>Open Sheet</Button>
<Sheet
visible={sheetVisible}
onClose={() => setSheetVisible(false)}
title="Action Sheet"
>
Sheet content
</Sheet>
</Page>
);
}
import React from "react";
import { Page, Button, Sheet } from "zmp-ui";
function HomePage(props){
const [sheetVisible, setSheetVisible] = useState(false);
return (
<Page>
<Button onClick={() => {setSheetVisible(true)}}>Open Sheet</Button>
<Sheet.Actions
visible={sheetVisible}
title="Action Sheet"
onClose={() => setSheetVisible(false)}
actions={[
[
{
text: "button",
onClick: () => {
alert("click");
},
},
{ text: "button", highLight: true },
],
[{ text: "cancel", close: true, danger: true }],
]}
/>
</Page>
);
}