ant-design/components/tooltip/demo/placement.md

93 lines
2.1 KiB
Markdown
Raw Normal View History

2016-03-31 09:40:55 +08:00
---
order: 1
2017-10-16 19:53:46 +08:00
title:
2016-08-02 16:06:46 +08:00
zh-CN: 位置
en-US: Placement
2016-03-31 09:40:55 +08:00
---
2015-06-03 17:08:43 +08:00
2016-08-02 16:06:46 +08:00
## zh-CN
2015-11-03 13:50:36 +08:00
位置有 12 个方向。
2015-06-03 17:08:43 +08:00
2017-10-16 19:53:46 +08:00
## en-US
2016-08-02 16:06:46 +08:00
2019-04-19 20:46:08 +08:00
There are 12 placement options available.
2016-08-02 16:06:46 +08:00
2019-05-07 14:57:32 +08:00
```jsx
2017-10-16 19:53:46 +08:00
import { Tooltip, Button } from 'antd';
2016-08-02 16:06:46 +08:00
const text = <span>prompt text</span>;
2015-06-03 17:08:43 +08:00
2017-10-16 19:53:46 +08:00
const buttonWidth = 70;
2015-10-20 16:47:55 +08:00
ReactDOM.render(
2017-10-16 19:53:46 +08:00
<div className="demo">
<div style={{ marginLeft: buttonWidth, whiteSpace: 'nowrap' }}>
2015-11-04 19:32:54 +08:00
<Tooltip placement="topLeft" title={text}>
2017-10-16 19:53:46 +08:00
<Button>TL</Button>
2015-11-04 19:32:54 +08:00
</Tooltip>
<Tooltip placement="top" title={text}>
2017-10-16 19:53:46 +08:00
<Button>Top</Button>
2015-11-04 19:32:54 +08:00
</Tooltip>
<Tooltip placement="topRight" title={text}>
2017-10-16 19:53:46 +08:00
<Button>TR</Button>
2015-11-04 19:32:54 +08:00
</Tooltip>
</div>
2017-10-16 19:53:46 +08:00
<div style={{ width: buttonWidth, float: 'left' }}>
2015-11-04 19:32:54 +08:00
<Tooltip placement="leftTop" title={text}>
2017-10-16 19:53:46 +08:00
<Button>LT</Button>
2015-11-04 19:32:54 +08:00
</Tooltip>
<Tooltip placement="left" title={text}>
2017-10-16 19:53:46 +08:00
<Button>Left</Button>
2015-11-04 19:32:54 +08:00
</Tooltip>
<Tooltip placement="leftBottom" title={text}>
2017-10-16 19:53:46 +08:00
<Button>LB</Button>
2015-11-04 19:32:54 +08:00
</Tooltip>
</div>
2019-05-07 14:57:32 +08:00
<div style={{ width: buttonWidth, marginLeft: buttonWidth * 4 + 24 }}>
2015-11-04 19:32:54 +08:00
<Tooltip placement="rightTop" title={text}>
2017-10-16 19:53:46 +08:00
<Button>RT</Button>
2015-11-04 19:32:54 +08:00
</Tooltip>
<Tooltip placement="right" title={text}>
2017-10-16 19:53:46 +08:00
<Button>Right</Button>
2015-11-04 19:32:54 +08:00
</Tooltip>
<Tooltip placement="rightBottom" title={text}>
2017-10-16 19:53:46 +08:00
<Button>RB</Button>
2015-11-04 19:32:54 +08:00
</Tooltip>
</div>
2017-10-16 19:53:46 +08:00
<div style={{ marginLeft: buttonWidth, clear: 'both', whiteSpace: 'nowrap' }}>
2015-11-04 19:32:54 +08:00
<Tooltip placement="bottomLeft" title={text}>
2017-10-16 19:53:46 +08:00
<Button>BL</Button>
2015-11-04 19:32:54 +08:00
</Tooltip>
<Tooltip placement="bottom" title={text}>
2017-10-16 19:53:46 +08:00
<Button>Bottom</Button>
2015-11-04 19:32:54 +08:00
</Tooltip>
<Tooltip placement="bottomRight" title={text}>
2017-10-16 19:53:46 +08:00
<Button>BR</Button>
2015-11-04 19:32:54 +08:00
</Tooltip>
</div>
2018-06-27 15:55:04 +08:00
</div>,
2019-05-07 14:57:32 +08:00
mountNode,
2018-11-28 15:00:03 +08:00
);
2019-05-07 14:57:32 +08:00
```
2015-06-03 20:43:03 +08:00
<style>
2017-10-16 19:53:46 +08:00
.code-box-demo .demo {
overflow: auto;
}
.code-box-demo .ant-btn {
margin-right: 8px;
margin-bottom: 8px;
}
.code-box-demo .ant-btn-rtl {
margin-right: 0;
margin-left: 8px;
margin-bottom: 8px;
}
2017-10-16 19:53:46 +08:00
#components-tooltip-demo-placement .ant-btn {
width: 70px;
2015-11-03 14:25:34 +08:00
text-align: center;
2017-10-16 19:53:46 +08:00
padding: 0;
2015-06-03 20:43:03 +08:00
}
</style>