Theme

React Bootstrap 5 Theme

Theming system enables you to customize the appearance of all MDB components.

Appearance customization options enable you to create skins for your Bootstrap 5 project. Use predefined dark theme, light theme or create custom themes.

See an example of a dark-theme created using our theme system.


How to start

Creating a theme requires recompiling the scss styles, for this purpose we recommend using sass compiler

Step 1

Install sass

        
            
            npm i sass
          
        
    

Step 2

Copy scss folder from node_modules/mdb-react-ui-kit/dist

Step 3

Put copied files into the src folder.

Step 4

Create an index.scss file in the scss folder and import MDB Pro scss styles:

        
            
            @import './mdb.pro.scss';;
          
        
    

Step 5

In your root index.js file instead of importing CSS stylesheet:

        
            
            import 'mdb-react-ui-kit/dist/css/mdb.min.css';
          
        
    

Import index.scss file:

        
            
            import './scss/index.scss';
          
        
    

Create a new theme

Creating a new theme requires that you define primary and secondary colors for your application. We prepared functions and mixins that will help you to create a ready to use theme using these colors.

Go to scss folder you copied before, open index.scss file located in src/scss folder and replace the code there with the following code:

        
            
            @import './mdb.pro.scss';

            $my-theme-primary: #9c27b0; // theme primary color, change this value to customize theme
            $my-theme-secondary: #69f0ae; // theme secondary color, change this value to customize theme

            $my-theme: mdb-light-theme($my-theme-primary, $my-theme-secondary); // create the new theme using primary and
            // secondary colors

            // include theme styles
            @include mdb-theme($my-theme);
          
        
    

Light theme

It's possible to create a light theme using mdb-light-theme function. You just need to define primary and secondary colors, all other parameters will be adjusted automatically.

        
            
            @import './mdb.pro.scss';

            $my-theme-primary: #9c27b0; // theme primary color, change this value to customize theme
            $my-theme-secondary: #69f0ae; // theme secondary color, change this value to customize theme

            $my-light-theme: mdb-light-theme($my-theme-primary, $my-theme-secondary); // create the new light theme using
            // primary and secondary colors

            // include theme styles
            @include mdb-theme($my-light-theme);
          
        
    

Dark theme

It's possible to create a dark theme using mdb-dark-theme function. You just need to define primary and secondary colors, all other parameters will be adjusted automatically.

        
            
            @import './mdb.pro.scss';

            $my-theme-primary: #9c27b0; // theme primary color, change this value to customize theme
            $my-theme-secondary: #69f0ae; // theme secondary color, change this value to customize theme

            $my-dark-theme: mdb-dark-theme($my-theme-primary, $my-theme-secondary); // create the new dark theme using
            // primary and secondary colors

            // include theme styles
            @include mdb-theme($my-dark-theme);
          
        
    

Ready-to-use dark skin

For your convenience, we added a ready-to-use dark skin to our UI KIT pro essential and pro advanced. Installation is very easy, because you just need to replace the current mdb.min.css stylesheet path with mdb.dark.min.css. The files are located in the mdb-react-ui-kit/dist/css.

        
            
            import 'mdb-react-ui-kit/dist/css/mdb.dark.min.css';