ant-design/components/switch/demo/text.md
2022-05-23 14:37:16 +08:00

37 lines
626 B
Markdown

---
order: 2
title:
zh-CN: 文字和图标
en-US: Text & icon
---
## zh-CN
带有文字和图标。
## en-US
With text and icon.
```tsx
import { CheckOutlined, CloseOutlined } from '@ant-design/icons';
import { Switch } from 'antd';
import React from 'react';
const App: React.FC = () => (
<>
<Switch checkedChildren="开启" unCheckedChildren="关闭" defaultChecked />
<br />
<Switch checkedChildren="1" unCheckedChildren="0" />
<br />
<Switch
checkedChildren={<CheckOutlined />}
unCheckedChildren={<CloseOutlined />}
defaultChecked
/>
</>
);
export default App;
```