Open In App

React.js BluePrint Breadcrumbs Component CSS

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 will discuss React.js BluePrint Breadcrumbs Component CSS.

Breadcrumbs Component provides a way for users to identify the path to the current resource in an application. There are different ways to design Breadcrumb.

React.js BluePrint Breadcrumbs CSS Classes:

  • bp4-breadcrumbs: It is used to denote a container of breadcrumbs.
  • bp4-breadcrumb: It is used to denote a breadcrumb.
  • bp4-disabled: It is used to indicate whether this action is non-interactive.
  • bp4-breadcrumb-current: It is used to indicate whether this breadcrumb is the current breadcrumb.
  • bp4-breadcrumbs-collapsed: It is used to indicate the collapsed breadcrumbs.

Approach: Let us create a React project and install React Blueprint module. Then we will create a UI that will showcase React.js BluePrint Breadcrumbs Component CSS.

Syntax:

<ul class="bp4-breadcrumbs">
    <li><a className="bp4-breadcrumbs-collapsed" 
        href="..."></a></li>
    <li><a className="bp4-breadcrumb" 
        href="..." >...</a></li>
     ...
    <li><span className="bp4-breadcrumb 
        bp4-breadcrumb-current">...</span></li>
</ul>

Creating React Project & Installing Required Modules:

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.js BluePrint Breadcrumbs Component CSS.

App.js




import React from "react";
import "@blueprintjs/core/lib/css/blueprint.css";
  
export default function App() {
    return (
        <div style={{ margin: 100 }}>
            <h1 style={{ color: "green" }}>
                GeeksforGeeks
            </h1>
            <h3>
                React.js BluePrint Breadcrumbs Component CSS
            </h3>
            <ul class="bp4-breadcrumbs">
                <li>
                    <a 
                        className="bp4-breadcrumbs-collapsed" 
                        href="/path1">
                    </a>
                </li>
                <li>
                    <a 
                        className="bp4-breadcrumb" 
                        href="/path2" >
                        Path 2
                    </a>
                </li>
                <li>
                    <span 
                        className="bp4-breadcrumb 
                            bp4-breadcrumb-current">
                        Path 3
                    </span>
                </li>
            </ul>
        </div>
    );
}


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

 

Example 2: This example shows React.js BluePrint disabled Breadcrumbs Component CSS.

App.js




import React from "react";
import "@blueprintjs/core/lib/css/blueprint.css";
  
export default function App() {
    return (
        <div style={{ margin: 100 }}>
            <h1 style={{ color: "green" }}>
                GeeksforGeeks
            </h1>
            <h3>
                React.js BluePrint Breadcrumbs Component CSS
            </h3>
            <ul class="bp4-breadcrumbs">
                <li>
                    <span 
                        className="bp4-breadcrumb bp4-disabled">
                        Path one
                    </span>
                </li>
                <li>
                    <span 
                        className="bp4-breadcrumb bp4-disabled">
                        Path two
                    </span>
                </li>
                <li>
                    <span 
                        className="bp4-breadcrumb 
                            bp4-breadcrumb-current">
                        Path three
                    </span>
                </li>
            </ul>
        </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/breadcrumbs.css



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