mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-13 23:59:12 +08:00
6776bb8916
* docs: update demo * chore: add script * test: fix demo test * docs: convert demos * chore: move script * test: remove react-dom import * chore: update deps * docs: update riddle js * test: fix image test * docs: fix riddle demo
34 lines
571 B
Markdown
34 lines
571 B
Markdown
---
|
|
order: 2
|
|
title:
|
|
zh-CN: 文字和图标
|
|
en-US: Text & icon
|
|
---
|
|
|
|
## zh-CN
|
|
|
|
带有文字和图标。
|
|
|
|
## en-US
|
|
|
|
With text and icon.
|
|
|
|
```jsx
|
|
import { Switch } from 'antd';
|
|
import { CloseOutlined, CheckOutlined } from '@ant-design/icons';
|
|
|
|
export default () => (
|
|
<>
|
|
<Switch checkedChildren="开启" unCheckedChildren="关闭" defaultChecked />
|
|
<br />
|
|
<Switch checkedChildren="1" unCheckedChildren="0" />
|
|
<br />
|
|
<Switch
|
|
checkedChildren={<CheckOutlined />}
|
|
unCheckedChildren={<CloseOutlined />}
|
|
defaultChecked
|
|
/>
|
|
</>
|
|
);
|
|
```
|