| 1 |
export interface FormSelectOptionGroupProps extends Omit<React.HTMLProps<HTMLOptGroupElement>, 'disabled'> { |
| 2 |
/** content rendered inside the Select Option Group */ |
| 3 |
children?: React.ReactNode; |
| 4 |
/** additional classes added to the Select Option */ |
| 5 |
className?: string; |
| 6 |
/** the label for the option */ |
| 7 |
label: string; |
| 8 |
/** flag indicating if the Option Group is disabled */ |
| 9 |
isDisabled?: boolean; |
| 10 |
} |
| 11 |
|
| 12 |
export const FormSelectOptionGroup: React.FunctionComponent<FormSelectOptionGroupProps> = ({ |
| 13 |
children = null, |
| 14 |
className = '', |
| 15 |
isDisabled = false, |
| 16 |
label, |
| 17 |
...props |
| 18 |
}: FormSelectOptionGroupProps) => ( |
| 19 |
<optgroup {...props} disabled={!!isDisabled} className={className} label={label}> |
| 20 |
{children} |
| 21 |
</optgroup> |
| 22 |
); |
| 23 |
FormSelectOptionGroup.displayName = 'FormSelectOptionGroup'; |