ant-design/components/date-picker/demo/suffix.md
07akioni 5a08aab0e8
docs: DatePicker demo refactor (#25913)
* docs: DatePicker change type demo

* chore: snapshot

* chore

* docs: DatePicker use Space

* chore: snapshot
2020-07-30 19:17:34 +08:00

1.1 KiB

order debug title
99 true
zh-CN en-US
后缀图标 Suffix

zh-CN

最简单的用法,在浮层中可以选择或者输入日期。

en-US

Basic use case. Users can select or input a date in panel.

import { DatePicker, Space } from 'antd';
import { SmileOutlined } from '@ant-design/icons';

const smileIcon = <SmileOutlined />;
const { RangePicker } = DatePicker;

function onChange(date, dateString) {
  console.log(date, dateString);
}

ReactDOM.render(
  <Space direction="vertical" size={12}>
    <DatePicker suffixIcon={smileIcon} onChange={onChange} />
    <DatePicker suffixIcon={smileIcon} onChange={onChange} picker="month" />
    <RangePicker suffixIcon={smileIcon} onChange={onChange} />
    <DatePicker suffixIcon={smileIcon} onChange={onChange} picker="week" />
    <DatePicker suffixIcon="ab" onChange={onChange} />
    <DatePicker suffixIcon="ab" onChange={onChange} picker="month" />
    <RangePicker suffixIcon="ab" onChange={onChange} />
    <DatePicker suffixIcon="ab" onChange={onChange} picker="week" />
  </Space>,
  mountNode,
);