question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Box] No MuiBox property defined in ThemeOptions.overrides (typescript)

See original GitHub issue

can not override MuiBox theme from createMuiTheme in typescrpt, because ThemeOptions.overrides doesn’t provide MuiBox

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

when we try to add MuiBox property in overrides object for creating new theme, it says : Object literal may only specify known properties, and 'MuiBox' does not exist in type 'Overrides'

Expected Behavior 🤔

ThemeOptions.overrides type should contain MuiBox property

Steps to Reproduce 🕹

https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbzgYygUwIYzQWQK7AAqAFmiGnAL5wBmUEIcARAAIhZpTAYA2AtAQD0yaGkEBnGAE8eacUwDcAKCVoAHpFgoIAO0lwYpcnAC8KdB3xEjaABQIlcOIMGcocAFxwA8gCMAVmjI8DzA2FC8cOxScLo8MeJgQcA0MQDWOhAA7jpwYPRJsMByADRwGDoAJnAA5FYAQhBqNXCVEHJwmfDqwPrAudJJtd4Abm7AlXKOcA1NnogqTpRKlACUSkA Steps:

  1. create a theme with createMuiTheme
  2. add overrides property to it
  3. try adding MuiBox to overrides
`npx @material-ui/envinfo`

System: OS: Linux 5.4 Linux Mint 20.1 (Ulyssa) Binaries: Node: 15.14.0 - ~/.nvm/versions/node/v15.14.0/bin/node Yarn: Not Found npm: 7.7.6 - ~/.nvm/versions/node/v15.14.0/bin/npm Browsers: Chrome: 89.0.4389.114 Firefox: 87.0 npmPackages: @material-ui/core: ^4.11.0 => 4.11.0 @material-ui/icons: ^4.9.1 => 4.9.1 @material-ui/lab: 4.0.0-alpha.56 => 4.0.0-alpha.56 @material-ui/pickers: ^3.2.10 => 3.2.10 @material-ui/styles: ^4.10.0 => 4.10.0 @material-ui/system: 4.9.14 @material-ui/types: 5.1.0 @material-ui/utils: 4.10.2 @types/react: ^16.9.0 => 16.9.46 react: ^16.13.1 => 16.13.1 react-dom: ^16.13.1 => 16.13.1 styled-components: 5.2.0 typescript: ^3.9.7 => 3.9.7

tsconfig { "compilerOptions": { "target": "es5", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, "strict": true, "noImplicitAny": false, "strictFunctionTypes": false, "forceConsistentCasingInFileNames": true, "module": "esnext", "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, "baseUrl": "src", "jsx": "preserve", "experimentalDecorators": true }, "include": ["src"], "exclude": ["node_modules"] }

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
dknadratsenkacommented, Apr 17, 2021

@mnajdova thanks. It would help my migration if you would add this class back.

1reaction
mnajdovacommented, Apr 16, 2021

@dknadratsenka my bad for not adding the MuiBox-root class on the Box component, we should definitely add it. Would that help your migration? I’d say you could easily move the overrides from the MuiBox to the MuiCssBaseline style overrides inside the theme for example, by using the MuiBox-root class:

https://codesandbox.io/s/nervous-dust-fmbl6?file=/src/App.js

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Box] No MuiBox property defined in ThemeOptions. ...
can not override MuiBox theme from createMuiTheme in typescrpt, because ThemeOptions.overrides doesn't provide MuiBox The issue is present ...
Read more >
Override Box component in createTheme - reactjs
You can override the Card styles globally using createTheme() because the Card has a name and a styleOverrides callback when it is styled ......
Read more >
Global Styling with Material-UI Theme Overrides and Props
Learn how to use global CSS overrides and default props in a theme to customize all instances of a Material-UI component in a...
Read more >
React Material UI Tutorial - 46 - Customizing Theme - YouTube
Courses - https://learn.codevolution.dev/ Support - https://www.paypal.me/Codevolution Github - https://github.com/gopinav ...
Read more >
Extend Material-UI theme in TypeScript
Object literal may only specify known properties, and 'success' does not exist in type 'PaletteOptions'. It means that because Material-UI ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found