ant-design/components/segmented/demo/controlled.md
vagusX eee3b50727
feat: support icon only in segmented (#35256)
* feat: support icon only with segmented

* fix: lint issue

* chore: update

* test: fix

* test: update snapshot
2022-04-28 19:39:52 +08:00

445 B

order title
3
zh-CN en-US
受控模式 Controlled mode

zh-CN

受控的 Segmented。

en-US

Controlled Segmented.

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;