Open In App

React.js Blueprint Component Tabs CSS

Last Updated : 15 Sep, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

BlueprintJS is a React-based UI toolkit for the web. This library is very optimized and popular for building interfaces that are complex and data-dense for desktop applications. In this article, we are going to discuss React.js BluePrint Tabs CSS Component. Tabs Component allows the user to switch between components present in given different tabs.

Tabs CSS Class:

  • bp4-tabs: It is used to denote the group of tabs with title and content.
  • bp4-tab-list: It is used to denote the group of tabs titles.
  • bp4-tab-panel: It is used to denote a tab panel denoting the content. 
  • bp4-tab: It is used to denote a tab. 
  • bp4-large: The tab titles will display with larger styling when this is set to true.
  • aria-disabled: It takes a boolean value. It is used to denote a disabled tab.    
  • aria-hidden: It takes a boolean value. It is used to hide tab content.

Let’s create a React project and install React Blueprint module. Then we will create a UI that will showcase React.js BluePrint Tabs Component CSS.

Creating React Project:

Step 1: To create a react app, you need to install react modules through the npx command. “npx” is used instead of “npm” because you will be needing this command in your app’s lifecycle only once.

npx create-react-app project_name

Step 2: After creating your react project, move into the folder to perform different operations.

cd project_name

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

npm install @blueprintjs/core

Project Structure: After running the commands mentioned in the above steps, if you open the project in an editor you can see a similar project structure as shown below. The new component user makes or the code changes, we will be performing will be done in the source folder. 

Project Structure

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

npm start

Example 1: We are creating a UI that shows React BluePrint Tabs Component CSS.

  • Filename: App.js

App.js




import React from "react";
import "@blueprintjs/core/lib/css/blueprint.css";
  
export default function App() {
    return (
        <div style={{ margin: 100, textAlign: "center"
            width: 600 }}>
            <h1 style={{ color: "green" }}>GeeksforGeeks</h1>
            <h3>React BluePrint Tabs Component CSS</h3>
            <div class="bp4-tabs bp4-large">
                <ul class="bp4-tab-list" role="tablist">
                    <li class="bp4-tab" role="tab" >
                        DSA Self Paced Course
                    </li>
                    <li class="bp4-tab" role="tab" 
                        aria-disabled="true">
                        Course 2
                    </li>
                    <li class="bp4-tab" role="tab"
                        aria-disabled="true">
                        Course 3
                    </li>
                </ul>
                <div class="bp4-tab-panel" role="tabpanel" >
                    Most popular course on DSA trusted by
                    over 75,000 students! Built with years
                    of experience by industry experts and
                    gives you a complete package of video
                    lectures, practice problems, quizzes,
                    discussion forums and contests.<br />
                    Start Today !
                </div>
                <div class="bp4-tab-panel" 
                    role="tabpanel" aria-hidden="true">
                     Tab content 2
                </div>
            </div>
        </div>
    );
}


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

 

Example 2: We are creating a UI that shows React BluePrint Tabs Component CSS.

  • Filename: App.js

App.js




import React from "react";
import "@blueprintjs/core/lib/css/blueprint.css";
  
export default function App() {
    return (
        <div style={{ margin: 100, textAlign: "center"
            width: 600 }}>
            <h1 style={{ color: "green" }}>
                GeeksforGeeks
            </h1>
            <h3>
                React BluePrint Tabs Component CSS
            </h3>
            <div class="bp4-tabs ">
                <ul class="bp4-tab-list " role="tablist">
                    <li class="bp4-tab" role="tab" >
                        Tab 1
                    </li>
                    <li class="bp4-tab" role="tab" >
                        Tab 2
                    </li>
                    <li class="bp4-tab" role="tab" >
                        Tab 3
                    </li>
                </ul>
                <div class="bp4-tab-panel" role="tabpanel" >
                    Tab content 1
                </div>
                <div class="bp4-tab-panel" role="tabpanel" 
                    aria-hidden="true">
                        Tab content 2
                </div>
                <div class="bp4-tab-panel" role="tabpanel" 
                    aria-hidden="true">
                        Tab content 3
               </div>
            </div>
        </div>
    );
}


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

 

Reference: https://blueprintjs.com/docs/#core/components/tabs.css



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads