gregnb / mui-datatables

Datatables for React using Material-UI
MIT License
2.71k stars 932 forks source link

MuiThemeProvide in tsx #1128

Open shaka0241 opened 4 years ago

shaka0241 commented 4 years ago

Expected Behavior

hi, how can i set a theme by the MuiThemeProvider, in my tsx file.

Current Behavior

image

Your Environment

Tech Version
Material-UI ^4.0.2
MUI-datatables ^2.10.0
React ^16.8.6
browser chrome
etc
ff-luis-carrillo commented 4 years ago

Hello @shaka0241, MuiIDataTables uses Material-UI components.

If you want to override MuiDatatables styles you should override the Material-UI component styles, in this case, use MuiTableRow instead of MUIDataTableBodyRow

GuilhermeBohnstedt commented 4 years ago

Hi. I found other solution.

If you analyse createMuiTheme you will see this: https://github.com/mui-org/material-ui/blob/743e26d89638d8f52c66c25f1dbc6e49ee9a4138/packages/material-ui/src/styles/createMuiTheme.js#L44

createMuiTheme will do a deepmerge. So you can use the custom names.

You can do something like this: const theme = createMuiTheme( {}, { overrides: { MUIDataTableBodyCell: { root: { backgroundColor: '#FF0000', }, }, }, }, );

Like the example...