-
-
Notifications
You must be signed in to change notification settings - Fork 46.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Modal width out of screen (#25765)
* style(modal): add max-width * chore(modal): add custom width demo * test(modal): add custom width snapshot * Update modal.less * Update modal.less * Update width.md * Update demo.test.js.snap Co-authored-by: 偏右 <afc163@gmail.com>
- Loading branch information
1 parent
b0c70ab
commit 6d28542
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
order: 13 | ||
title: | ||
zh-CN: 自定义模态的宽度 | ||
en-US: To customize the width of modal | ||
--- | ||
|
||
## zh-CN | ||
|
||
使用 `width` 来设置模态对话框的宽度。 | ||
|
||
## en-US | ||
|
||
Use `width` to set the width of the modal dialog. | ||
|
||
```jsx | ||
import React, { useState } from 'react'; | ||
import { Modal, Button } from 'antd'; | ||
|
||
const App = () => { | ||
const [visible, setVisible] = useState(false); | ||
return ( | ||
<> | ||
<Button type="primary" onClick={() => setVisible(true)}> | ||
Open Modal of 1000px width | ||
</Button> | ||
<Modal | ||
title="Modal 1000px width" | ||
centered | ||
visible={visible} | ||
onOk={() => setVisible(false)} | ||
onCancel={() => setVisible(false)} | ||
width={1000} | ||
> | ||
<p>some contents...</p> | ||
<p>some contents...</p> | ||
<p>some contents...</p> | ||
</Modal> | ||
</> | ||
); | ||
} | ||
|
||
ReactDOM.render(<App />, mountNode); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters