Are you ready for Cyber Week Deals?

Up to 70% discount for CoreUI PRO Admin Templates and UI Components.

This year we prepared a limited Cyber Week offer for our clients and users. The first 100 people can get our products with up to 70% discount.

Customize react templates

Learn how to theme, customize, and extend CoreUI React Templates with Sass, a boatload of global options.

Overview#

There are multiple ways to customize CoreUI for React. Your best path can depend on your project, the complexity of your build tools, the version of CoreUI for React you're using, browser support, and more.

Our two preferred methods are:

  1. You can extend our source files.
  2. You can override CoreUI’s styles.

File structure#

Utilize our source Sass files to take advantage of variables, maps, mixins, and functions to help you build faster and customize your project.

Whenever possible, avoid modifying CoreUI's core files. For Sass, that means creating your own stylesheet that imports CoreUI for React so you can modify and extend it. Assuming you're using a package manager like npm, you'll have a file structure that looks like this:

1your-project/
2├── ...
3├── node_modules/
4│ ├── @coreui/coreui
5│ │ ├── scss
6│ │ └── ...
7│ └── @coreui/react
8│ └── ...
9├── src
10│ └── scss
11│ ├── _custom.scss
12│ ├── ...
13│ ├── _variables.scss
14│ └── ...
15└── ...

If you use CoreUI PRO version.

1your-project/
2├── ...
3├── node_modules/
4│ ├── @coreui/coreui-pro
5│ │ ├── scss
6│ │ └── ...
7│ └── @coreui/react-pro
8│ └── ...
9├── src
10│ └── scss
11│ ├── _custom.scss
12│ ├── ...
13│ ├── _variables.scss
14│ └── ...
15└── ...

Variable defaults#

Every Sass variable in CoreUI for React includes the !default flag allowing you to override the variable's default value in your own Sass without modifying CoreUI's source code. Copy and paste variables as needed, modify their values, and remove the !default flag. If a variable has already been assigned, then it won't be re-assigned by the default values in CoreUI.

You will find the complete list of CoreUI's variables in node_modules/@coreui/coreui/scss/_variables.scss or in node_modules/@coreui/coreui-pro/scss/_variables.scss. Some variables are set to null, these variables don't output the property unless they are overridden in your configuration. You can also find a specific component variables list in Customizing section ex. Alerts - Customizing

Here's an example that changes the background-color and color for the <body> when importing and compiling CoreUI for React via npm:

1// _variables.scss
2
3// Default variable overrides
4$body-bg: #000;
5$body-color: #111;

Custom styles and overrides#

In your custom.scss, you can put custom code for CoreUI's components or your own styles.

1// _custom.scss
2
3// Additional custom code here
4.custom-component {
5 border: 2px solid #222;
6}