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

87 lines
2.0 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
The ToolTip has 12 placements choice.
2017-02-13 10:55:53 +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>
2017-10-16 19:53:46 +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>
2015-06-03 20:43:03 +08:00
</div>
, mountNode);
2015-06-03 17:08:43 +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;
}
#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>