import React from 'react'; import { FormSelect, FormSelectOption, FormSelectOptionGroup } from '@patternfly/react-core'; export const FormSelectGrouped: React.FunctionComponent = () => { const [formSelectValue, setFormSelectValue] = React.useState('2'); const onChange = (_event: React.FormEvent, value: string) => { setFormSelectValue(value); }; const groups = [ { groupLabel: 'Group1', disabled: false, options: [ { value: '1', label: 'The first option', disabled: false }, { value: '2', label: 'Second option is selected by default', disabled: false } ] }, { groupLabel: 'Group2', disabled: false, options: [ { value: '3', label: 'The third option', disabled: false }, { value: '4', label: 'The fourth option', disabled: false } ] }, { groupLabel: 'Group3', disabled: true, options: [ { value: '5', label: 'The fifth option', disabled: false }, { value: '6', label: 'The sixth option', disabled: false } ] } ]; return ( {groups.map((group, index) => ( {group.options.map((option, i) => ( ))} ))} ); };