Open In App

React.js Blueprint Variables Light theme styles

Improve
Improve
Like Article
Like
Save
Share
Report

In this article, we will learn about the Light Theme Style Variables offered by the blueprint.js library. BlueprintJS is a React-based UI toolkit for the web. It is written in Typescript. This library is very optimized and popular for building interfaces that are complex and data-dense for desktop applications that run in a modern web browser.

Light Theme Style Variables: These variables are used to build custom UI components that should look similar to Light-themed BlueprintJS components.

Light Theme Style Variables:

  • $pt-dialog-box-shadow: It corresponds to the following value in CSS.
$pt-dialog-box-shadow: 
    0 0 0 1px rgba(17, 20, 24, 0.1),
      0 2px 4px rgba(17, 20, 24, 0.2), 
      0 8px 24px rgba(17, 20, 24, 0.2)
  • $pt-input-box-shadow: It corresponds to the following value in CSS.
$pt-input-box-shadow: 
    inset 0 0 0 1px rgba(17, 20, 24, 0.2),
      inset 0 1px 1px rgba(17, 20, 24, 0.5)
  • $pt-popover-box-shadow: It corresponds to the following value in CSS.
$pt-popover-box-shadow: 
    0 0 0 1px rgba(17, 20, 24, 0.1),
      0 2px 4px rgba(17, 20, 24, 0.2), 
      0 8px 24px rgba(17, 20, 24, 0.2)
  • $pt-tooltip-box-shadow: It corresponds to the following value in CSS.
$pt-tooltip-box-shadow: 
    0 0 0 1px rgba(17, 20, 24, 0.1),
      0 2px 4px rgba(17, 20, 24, 0.2), 
      0 8px 24px rgba(17, 20, 24, 0.2)

 

Creating React Application And Installing Module

Step 1: Create a React application using the following command:

npx create-react-app foldername

Step 2: After creating your project folder i.e. foldername, move to it using the following command:

cd foldername

Step 3: After creating the ReactJS application, Install the required module using the following command:

npm install @blueprintjs/core
npm install sass

Project Structure: It will look like the following.

 

Example 1: The below example demonstrates the usage of different Light Theme Style Variables used by BlueprintJS. Now write down the following code in the App.js file. Here, App is our default component where we have written our code.

Filename: App.js

Javascript




import './App.scss'
import "@blueprintjs/core/lib/css/blueprint.css";
  
export default function App() {
    return (
        <div>
            <div
                className="head"
                style={{
                    width: "fit-content",
                    margin: "auto",
                }}
            >
                <h1
                    style={{
                        color: "green",
                    }}
                >
                    GeeksforGeeks
                </h1>
                <strong>
                    React blueprint Light Theme Style Variables:
                </strong>
                <br />
                <br />
            </div>
            <div className="container">
                <div className="box box-1"></div>
                <div className="box box-2"></div>
                <div className="box box-3"></div>
                <div className="box box-4"></div>
            </div>
        </div>
    );
}


Create a new file, App.scss, and assign different Light-themed style variables to different boxes.

Filename: App.scss

CSS




@import "@blueprintjs/core/lib/scss/variables";
  
.container {
    display: flex;
    margin: 0 auto;
    justify-content: center;
    gap: 5px;
}
  
.box {
    width: 100px;
    height: 100px;
    background-color: white;
}
  
.box-1 {
    box-shadow: $pt-dialog-box-shadow;
}
  
.box-2 {
    box-shadow: $pt-input-box-shadow;
}
  
.box-3 {
    box-shadow: $pt-popover-box-shadow;
}
  
.box-4 {
    box-shadow: $pt-tooltip-box-shadow;
}


Step to Run Application: Run the application using the following command from the root directory of the project:

npm start

Output: Now open your browser and go to http://localhost:3000/, you will see the following output:

 

Example 2: The below example demonstrates the usage of different Light-themed style variables with different shapes of boxes.

Filename: App.js

Javascript




import './App.scss'
import "@blueprintjs/core/lib/css/blueprint.css";
  
export default function App() {
    return (
        <div>
            <div
                className="head"
                style={{
                    width: "fit-content",
                    margin: "auto",
                }}
            >
                <h1
                    style={{
                        color: "green",
                    }}
                >
                    GeeksforGeeks
                </h1>
                <strong>
                    React blueprint Light Theme 
                    Style Variables:
                </strong>
                <br />
                <br />
            </div>
            <div className="container">
                <div className="box box-1"></div>
                <div className="box box-2"></div>
                <div className="box box-3"></div>
                <div className="box box-4"></div>
            </div>
        </div>
    );
}


Create a new file, App.scss, and assign different Light-themed style variables to different-shaped boxes.

Filename: App.scss

CSS




@import "@blueprintjs/core/lib/scss/variables";
  
.container {
    display: flex;
    margin: 0 auto;
    justify-content: center;
    gap: 10px;
}
  
.box-1 {
    width: 100px;
    height: 100px;
    background: red;
    box-shadow: $pt-dialog-box-shadow;
}
  
.box-2 {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: red;
    box-shadow: $pt-input-box-shadow;
}
  
.box-3 {
    width: 0;
    height: 0;
    border-left: 50px solid transparent;
    border-right: 50px solid transparent;
    border-bottom: 100px solid red;
    box-shadow: $pt-popover-box-shadow;
}
  
.box-4 {
    width: 100px;
    height: 100px;
    border-radius: 100px / 50%;
    background: red;
    box-shadow: $pt-tooltip-box-shadow;
}


Step to Run Application: Run the application using the following command from the root directory of the project:

npm start

Output:

 

Reference: https://blueprintjs.com/docs/#core/variables.light-theme-styles



Last Updated : 10 Oct, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads