themed "classes" prop is ignored #12013
vsarang posted onGitHub
The official documentation states that properties can be set for all instances of a component type via the theming functionality, however it appears that classes
can't be set from here (and I wasn't able to find any documentation listing this exemption).
I'm not sure if this is relevant, but this line of code in withStyles.js
seems to ignore the classes
that are returned from getThemeProps()
.
- This is a v1.x issue (v0.x is no longer maintained).
- I have searched the issues of this repository and believe that this is not a duplicate.
Expected Behavior
I expect this theme to apply the class "CUSTOM_BUTTON_CLASS" to all instances of the MuiButton
component.
const theme = createMuiTheme({
props: {
MuiButton: {
classes: {
root: 'CUSTOM_BUTTON_CLASS',
}
}
}
});
Current Behavior
The classes are not applied.
Steps to Reproduce (for bugs)
https://codesandbox.io/s/wowky8p83w
I've implemented the above theme and set up the MuiThemeProvider
appropriately (see src/pages/index.js:42
), but as you can see, the classes have not been applied to the button.
Context
I'm using react-admin
and trying to style the checkboxes within their provided Datagrid
. I don't want to reimplement the entire Datagrid
, but they have not exposed the ability to pass props into the MuiCheckbox
within it, so I must style it via theming. I need to target the svg
within the MuiCheckbox
with my styles, so I must set the classname.
Your Environment
<!--- Include as many relevant details about the environment with which you experienced the bug. -->
Tech | Version |
---|---|
Material-UI | v1.0.0 |
React | v16.2.0 |
browser | Version 67.0.3396.99 (Official Build) (64-bit) |