ant-design/components/select/demo/optgroup.md
2022-11-30 22:51:06 +08:00

749 B

order title
6
zh-CN en-US
分组 Option Group

zh-CN

OptGroup 进行选项分组。

en-US

Using OptGroup to group the options.

import { Select } from 'antd';
import React from 'react';

const handleChange = (value: string) => {
  console.log(`selected ${value}`);
};

const App: React.FC = () => (
  <Select
    defaultValue="lucy"
    style={{ width: 200 }}
    onChange={handleChange}
    options={[
      {
        label: 'Manager',
        options: [
          { label: 'Jack', value: 'jack' },
          { label: 'Lucy', value: 'lucy' },
        ],
      },
      {
        label: 'Engineer',
        options: [{ label: 'yiminghe', value: 'Yiminghe' }],
      },
    ]}
  />
);

export default App;