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

47 lines
749 B
Markdown

---
order: 6
title:
zh-CN: 分组
en-US: Option Group
---
## zh-CN
`OptGroup` 进行选项分组。
## en-US
Using `OptGroup` to group the options.
```tsx
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;
```