mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-13 15:49:10 +08:00
eee3b50727
* feat: support icon only with segmented * fix: lint issue * chore: update * test: fix * test: update snapshot
28 lines
445 B
Markdown
28 lines
445 B
Markdown
---
|
|
order: 3
|
|
title:
|
|
zh-CN: 受控模式
|
|
en-US: Controlled mode
|
|
---
|
|
|
|
## zh-CN
|
|
|
|
受控的 Segmented。
|
|
|
|
## en-US
|
|
|
|
Controlled Segmented.
|
|
|
|
```tsx
|
|
import React, { useState } from 'react';
|
|
import { Segmented } from 'antd';
|
|
|
|
const Demo: React.FC = () => {
|
|
const [value, setValue] = useState<string | number>('Map');
|
|
|
|
return <Segmented options={['Map', 'Transit', 'Satellite']} value={value} onChange={setValue} />;
|
|
};
|
|
|
|
export default Demo;
|
|
```
|