How to customize theme in Material UI

How to customize Material UI themes in Reactjs


Material UI is the #1 UI for Reactjs and it continues it journey. Can I customize theme in MUI ?

With custom theme object we can create and implement the theme for any component or a group of component using a wrapper component. We require the following

  • createTheme
  • ThemeProvider

CreateTheme

     const theme = createTheme(
        {
            palette:
                { mode: 'light'}
        }
    );

We can customize the them using the createtheme function.

ThemeProvider

With the ThemeProvider we can provide theme for the component tree. It take a theme as prop.

 return (
        <div>
            <ThemeProvider theme={theme} >
                {props.children}
            </ThemeProvider>
        </div>
    )

Author: Manoj

Developer and a self-learner, love to work with Reactjs, Angular, Node, Python and C#.Net

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.