ant-design/components/notification/demo/placement.md
Rex aadf623dc6 support notification pop up from topLeft or bottomRight or bottomLeft (#4700)
* update snapshots

* update snapshots

* support notification pop up from topLeft or bottomRight or bottomLeft

* update snapshots

* 1. add test
2. update doc
3. support `placement` arguments in `open` method

* update doc

* update doc.
2017-01-27 17:12:25 +08:00

1.1 KiB
Executable File

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

zh-CN

可以设置通知从右上角、右下角、左下角、左上角弹出。

en-US

A notification box can pop up from topRight or bottomRight or bottomLeft or topLeft.

import { Button, Select, notification } from 'antd';

const { Option } = Select;
const options = ['topLeft', 'topRight','bottomLeft', 'bottomRight'];
const openNotification = () => {
  notification.open({
    message: 'Notification Title',
    description: 'This is the content of the notification. This is the content of the notification. This is the content of the notification.',
  });
};

ReactDOM.render(
  <div>
    <Select
      defaultValue="topRight"
      style={{ width: 120, marginRight: 10 }}
      onChange={val => {
        notification.config({
          placement: val,
        });
      }}
    >
      {options.map(val => <Option key={val} value={val}>{val}</Option>)}
    </Select>
    <Button
      type="primary"
      onClick={openNotification}
    >
      Open the notification box
    </Button>
  </div>
, mountNode);