ant-design/components/tooltip/demo/placement.md
2016-08-02 16:06:46 +08:00

1.9 KiB

order title
1
zh-CN en-US
位置 Placement

zh-CN

位置有 12 个方向。

en-US

The ToolTip has 12 placements choice.

import { Tooltip } from 'antd';
const text = <span>prompt text</span>;

ReactDOM.render(
  <div>
    <div style={{ marginLeft: 60 }}>
      <Tooltip placement="topLeft" title={text}>
        <a href="#">topLeft</a>
      </Tooltip>
      <Tooltip placement="top" title={text}>
        <a href="#">top</a>
      </Tooltip>
      <Tooltip placement="topRight" title={text}>
        <a href="#">topRight</a>
      </Tooltip>
    </div>
    <div style={{ width: 60, float: 'left' }}>
      <Tooltip placement="leftTop" title={text}>
        <a href="#">leftTop</a>
      </Tooltip>
      <Tooltip placement="left" title={text}>
        <a href="#">left</a>
      </Tooltip>
      <Tooltip placement="leftBottom" title={text}>
        <a href="#">leftBottom</a>
      </Tooltip>
    </div>
    <div style={{ width: 60, marginLeft: 270 }}>
      <Tooltip placement="rightTop" title={text}>
        <a href="#">rightTop</a>
      </Tooltip>
      <Tooltip placement="right" title={text}>
        <a href="#">right</a>
      </Tooltip>
      <Tooltip placement="rightBottom" title={text}>
        <a href="#">rightBottom</a>
      </Tooltip>
    </div>
    <div style={{ marginLeft: 60, clear: 'both' }}>
      <Tooltip placement="bottomLeft" title={text}>
        <a href="#">bottomLeft</a>
      </Tooltip>
      <Tooltip placement="bottom" title={text}>
        <a href="#">bottom</a>
      </Tooltip>
      <Tooltip placement="bottomRight" title={text}>
        <a href="#">bottomRight</a>
      </Tooltip>
    </div>
  </div>
, mountNode);