In the [ButtonGroup API] it is listed that CSS overrides classes supports a property disabled that is applied when disabled=true. However passing this style with TypeScript causes typing errors:
No overload matches this call.
Overload 1 of 2, '(props: { component: ElementType<any>; } & { color?: "primary" | "secondary" | "default" | "inherit" | undefined; disabled?: boolean | undefined; disableFocusRipple?: boolean | undefined; disableRipple?: boolean | undefined; fullWidth?: boolean | undefined; size?: "small" | ... 2 more ... | undefined; variant?: "text" | ... 2 more ... | undefined; } & CommonProps<...> & Pick<...>): Element', gave the following error.
Type '{ disabled: string; }' is not assignable to type 'Partial<Record<ButtonGroupClassKey, string>>'.
Object literal may only specify known properties, and 'disabled' does not exist in type 'Partial<Record<ButtonGroupClassKey, string>>'.
Overload 2 of 2, '(props: DefaultComponentProps<ButtonGroupTypeMap<{}, "div">>): Element', gave the following error.
Type '{ disabled: string; }' is not assignable to type 'Partial<Record<ButtonGroupClassKey, string>>'.
Object literal may only specify known properties, and 'disabled' does not exist in type 'Partial<Record<ButtonGroupClassKey, string>>'.ts(2769)
withStyles.d.ts(107, 3): The expected type comes from property 'classes' which is declared here on type 'IntrinsicAttributes & { component: ElementType<any>; } & { color?: "primary" | "secondary" | "default" | "inherit" | undefined; disabled?: boolean | undefined; disableFocusRipple?: boolean | undefined; disableRipple?: boolean | undefined; fullWidth?: boolean | undefined; size?: "small" | ... 2 more ... | undefined; ...'
withStyles.d.ts(107, 3): The expected type comes from property 'classes' which is declared here on type 'IntrinsicAttributes & { color?: "primary" | "secondary" | "default" | "inherit" | undefined; disabled?: boolean | undefined; disableFocusRipple?: boolean | undefined; disableRipple?: boolean | undefined; fullWidth?: boolean | undefined; size?: "small" | ... 2 more ... | undefined; variant?: "text" | ... 2 more ... |...'

It should be possible to pass the disabled property and add CSS override classes when the buttongroup is disabled.
There is a workaround for the issue, however it is by no means perfect. The following screenshot shows what can be done to achieve the same effect:

Steps:
In our company style we want disabled buttons to not have a box-shadow. We currently need to achieve this using a workaround as seen in the codesandbox as the "disabled" class property is broken.
| Tech | Version |
| ----------- | ------- |
| Material-UI | v4.6.0 |
| React | v16.11.0 |
| Browser | Chrome latest |
| TypeScript | v3.6.3 || v3.7.2 |
@Favna Thanks for the report, the problem could be fixed with a change like this:
diff --git a/packages/material-ui/src/ButtonGroup/ButtonGroup.d.ts b/packages/material-ui/src/ButtonGroup/ButtonGroup.d.ts
index fa0899d9e..745c31d43 100644
--- a/packages/material-ui/src/ButtonGroup/ButtonGroup.d.ts
+++ b/packages/material-ui/src/ButtonGroup/ButtonGroup.d.ts
@@ -31,7 +31,8 @@ export type ButtonGroupClassKey =
| 'groupedOutlinedSecondary'
| 'groupedContained'
| 'groupedContainedPrimary'
- | 'groupedContainedSecondary';
+ | 'groupedContainedSecondary'
+ | 'disabled';
export type ButtonGroupProps<
D extends React.ElementType = ButtonGroupTypeMap['defaultComponent'],
Do you want to work on the issue?
Alternatively, a good workaround is to use the .Mui-disabled class name.
@oliviertassinari I can fix this
Most helpful comment
@oliviertassinari I can fix this