-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[theme] TypeError: theme.spacing
is not a function when using Chakra UI theme with Material UI theme & MUI X DataGrid
#38808
Comments
I believe there's a bug. When I use a Material UI component like the Button, it functions correctly. The issue may be because certain components in the DataGrid module use the |
theme.spacing
is not a function when using Chakra UI theme with Material UI theme & MUI X DataGrid
edit: well after pouring over github/stackoverflow docs, "fixed" by adding fonts: {
heading: `'Inter', sans-serif`,
body: `'Inter', sans-serif`,
},
spacing: () => 5, previously: currently having same issue when trying to render <DataGrid
columns={columns}
rows={rows}
getRowId={(row) => row._id.$oid}
slots={{
toolbar: GridToolbar,
}}
/> theme creation looks like the following (I believe its correct const chakraTheme = extendTheme({
spacing: 4,
colors: {
brand: {
50: '#f0e4ff',
100: '#cbb2ff',
200: '#a480ff',
300: '#7a4dff',
400: '#641bfe',
500: '#5a01e5',
600: '#5200b3',
700: '#430081',
800: '#2d004f',
900: '#14001f',
},
},
fonts: {
heading: `'Inter', sans-serif`,
body: `'Inter', sans-serif`,
},
})
const muiTheme = createTheme({ spacing: 4 })
ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<ChakraProvider theme={chakraTheme} resetCSS>
{/* Do this sa we can use Chakra and MUI at the same time: https://github.com/mui/material-ui/issues/25852#issuecomment-1489000484 */}
<MaterialThemeProvider theme={{ [THEME_ID]: muiTheme }}>
<BrowserRouter>
<StyledEngineProvider injectFirst>
<App />
</StyledEngineProvider>
</BrowserRouter>
</MaterialThemeProvider>
</ChakraProvider>
</React.StrictMode> |
Thanks @coopslarhette ! Maybe this fixed the issue when using GridToolbar but it did not fix it when using it with material ui component |
Has anyone fixed this bug? |
mui/mui-x#10484 |
Duplicates
Latest version
Steps to reproduce 🕹
Link to live example: https://codesandbox.io/p/sandbox/create-next-app-example-forked-ktl63y?file=/pages/index.js:1,1
Steps:
checkboxSelection=true
propCurrent behavior 😯
I am getting 'typeError: theme.spacing is not a function'
Expected behavior 🤔
I should be able to select/unselect rows through the checkboxes normally
Context 🔦
I have an app where the main theme used is chakraui. On one page I want to use the material ui data grid component. & I tried theme scoping and it didn't show any errors or strange ui when the table was rendered however when I tried selecting a row using the check boxes I got the error "theme.spacing is not a fn".
I have seen that theme scoping was tacked in this issue: #25852 & I have implemented the solution stated in the docs but it is not working for my case.
Your environment 🌎
```npx @mui/envinfo
The text was updated successfully, but these errors were encountered: