Reputation: 2138
I'm building one (own) Material-UI project which I can import whenever I create a new project. So this project only has material-ui and react (react as a peer dependency). I am able to import most of the material-ui components, but how can I have my own default theme file (Default MuiTheme)?
So, the react project which will import this custom material-ui project and have those default styles from default theme. But, if I want to customize, i should be able to override the mui theme.
Upvotes: 1
Views: 2418
Reputation: 100
You can create a mytheme.js file with custom theme and wrap your app in the ThemeProvder component to make it available for the entire app.
Here are the documentation links to the theme variables that you can use to customize
https://material-ui.com/customization/default-theme/#default-theme
https://material-ui.com/customization/theming/#theme-provider
Example: https://stackblitz.com/edit/esmns5-s5ft8h?file=demo.js
<ThemeProvider theme = {mytheme}>
<App/>
</ThemeProvider>
Upvotes: 0