mirror of
https://github.com/zhigang1992/react.git
synced 2026-03-27 22:54:38 +08:00
docs(modal): custom width and className
This commit is contained in:
@@ -127,6 +127,28 @@ Display popup content that requires attention or provides additional information
|
||||
}
|
||||
`} />
|
||||
|
||||
|
||||
<Playground
|
||||
title="Customizable"
|
||||
desc="Custom `width` or `className`."
|
||||
scope={{ Modal, Button, useModal }}
|
||||
code={`
|
||||
() => {
|
||||
const { setVisible, bindings } = useModal()
|
||||
return (
|
||||
<div>
|
||||
<Button auto onClick={() => setVisible(true)}>Show Modal</Button>
|
||||
<Modal width="35rem" {...bindings}>
|
||||
<Modal.Title>My Favorites</Modal.Title>
|
||||
<Modal.Content>
|
||||
<p>This is the width I want.</p>
|
||||
</Modal.Content>
|
||||
</Modal>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
`} />
|
||||
|
||||
<Attributes edit="/pages/en-us/components/modal.mdx">
|
||||
<Attributes.Title>Modal.Props</Attributes.Title>
|
||||
|
||||
@@ -135,6 +157,8 @@ Display popup content that requires attention or provides additional information
|
||||
| **open** | open or close | `boolean` | - | `false` |
|
||||
| **onOpen** | open event | `() => void` | - | - |
|
||||
| **onClose** | open event | `() => void` | - | - |
|
||||
| **width** | width of the modal dialog | `string` | - | `26rem` |
|
||||
| **wrapClassName** | className of the modal dialog | `string` | - | - |
|
||||
| **disableBackdropClick** | click background and don't close | `boolean` | - | `false` |
|
||||
| ... | native props | `HTMLAttributes` | `'autoFocus', 'name', 'className', ...` | - |
|
||||
|
||||
|
||||
@@ -126,6 +126,27 @@ export const meta = {
|
||||
}
|
||||
`} />
|
||||
|
||||
<Playground
|
||||
title="定制化"
|
||||
desc="自定义 `width` 或是 `className`。"
|
||||
scope={{ Modal, Button, useModal }}
|
||||
code={`
|
||||
() => {
|
||||
const { setVisible, bindings } = useModal()
|
||||
return (
|
||||
<div>
|
||||
<Button auto onClick={() => setVisible(true)}>Show Modal</Button>
|
||||
<Modal width="35rem" {...bindings}>
|
||||
<Modal.Title>我的最爱</Modal.Title>
|
||||
<Modal.Content>
|
||||
<p>酷,这才是我想要的宽度。</p>
|
||||
</Modal.Content>
|
||||
</Modal>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
`} />
|
||||
|
||||
<Attributes edit="/pages/zh-cn/components/modal.mdx">
|
||||
<Attributes.Title>Modal.Props</Attributes.Title>
|
||||
|
||||
@@ -134,6 +155,8 @@ export const meta = {
|
||||
| **open** | 打开或关闭对话框 | `boolean` | - | `false` |
|
||||
| **onOpen** | 对话框打开的事件 | `() => void` | - | - |
|
||||
| **onClose** | 对话框关闭的事件 | `() => void` | - | - |
|
||||
| **width** | 对话框的宽度 | `string` | - | `26rem` |
|
||||
| **wrapClassName** | 对话框的自定义样式类名 | `string` | - | - |
|
||||
| **disableBackdropClick** | 点击背景层时是否关闭对话框 | `boolean` | - | `false` |
|
||||
| ... | 原生属性 | `HTMLAttributes` | `'autoFocus', 'name', 'className', ...` | - |
|
||||
|
||||
|
||||
Reference in New Issue
Block a user