ThemeOptions TS typings appear to be incomplete
See original GitHub issueIn the documentation for themes it is suggested that you can do the following:
const theme = createMuiTheme({
palette: {
contrastThreshold: 3,
tonalOffset: 0.2,
},
status: {
danger: 'orange',
},
});
But it appears that the ThemeOptions
interface accepted by createMuiTheme
does not have the properties status
, contrastThreshold
or tonalOffset
. Not sure if its the docs or the typings which are incorrect.
- 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
Typings match what the documentation says you should be able to do
Current Behavior
Typings do not match what the documentation says you should be able to do
Your Environment
Tech | Version |
---|---|
Material-UI | v1.2.1 |
React | v16.4.0 |
browser | Chrome |
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:20 (15 by maintainers)
Top Results From Across the Web
ThemeOptions TS typings appear to be incomplete #11853
In the documentation for themes it is suggested that you can do the following: const theme = createMuiTheme({ palette: { contrastThreshold: ...
Read more >MUI v5 - Extending Typography variant in TypeScript creates ...
My theme.ts config looks like that: import { createTheme, ThemeOptions } from "@mui/material/styles" ...
Read more >@mui/types | Yarn - Package Manager
Important: This documentation covers modern versions of Yarn. For 1.x docs, see classic.yarnpkg.com. Yarn.
Read more >material-ui/core/CHANGELOG.md - UNPKG
219, - Simplify the theme overrides with TypeScript for the components in the ... We will look for hiring a new full-time member...
Read more >Extend Material-UI theme in TypeScript - In Plain English
So this article explains how you can extend Material-UI theme in TypeScript. Actually, if you master this article, you could extend other ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@pelotom @Slessi - I am also stuck on this problem. I tried it as the docs say but could not get contrastThreshold and tonalOffset to work. Appreciate your help.
I think I got it to work as with the same logic, as given in docs, I changed the PaletteOptions in createPalette declaration.
If my approach is incorrect please let me know.
The docs are what brought me here: https://material-ui.com/customization/themes/#createmuitheme-options-theme
This was listed as an example:
And in TS this results in: