Articles in this section
Category / Section

How to use SCSS in Syncfusion React Component?

1 min read

Overview


This article is about using SCSS files in a React application, created using the “create-react-app” utility.

Prerequisite


  • Node
  • NPM
  • Create React App
  • Node SASS

Installing Node & NPM


For installing Node.js on your machine, download the LTS (Long Time Support) version of windows setup from the following link.

https://nodejs.org/en/

NPM (Node Package Manager) will be installed automatically along with the Node.js setup.

Installing Create React App


Install the “create-react-app” utility package using the following NPM Command.

npm install -g create-react-app

Creating React Application


Use the following command to create react application.

 

Create-react-app ej2-react

 

React app

Installing Node Sass Package


You can install the “node-sass” package using the following command.

npm install node-sass --save

Create .env file


Create .env file in the root directory of the React application for set SASS include path variables.

sass include path


Rename the “.css” to “.scss”


Rename all the CSS file extension with SCSS file extension.

renaming scss


Customizing Syncfusion Theme using the SCSS Variables


Now, you can customize the Syncfusion theme using the SCSS variables as follows. 

$accent: blue;
@import "../node_modules/@syncfusion/ej2-react-buttons/styles/material.scss";

You can refer the Syncfusion documentation to integrate Syncfusion React components into a React application.

Run the application


Now, run the application using “npm run start”.

npm run start

 

result

Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/ej2-react-154008663

 

Conclusion

We hope you enjoyed learning about how to use SCSS in Syncfusion React Component.

You can refer to our React feature tour page to know about its other groundbreaking feature representations. You can also explore our documentation to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsBoldDesk Support, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied