Open In App

React.js Blueprint Tag Component Props

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 data-dense for desktop applications. Tag Component is used for categorizing or markup. Tags are great for lists of strings. There are different props available to design tags.

Blueprint Tag Component Props:

  • active: It is used to indicate whether the tag should appear in an active state or not.
  • className: It is used to denote a space-delimited list of class names to pass along to a child element.
  • elementRef: It is used to denote a ref handler or a ref object that receives the native HTML element rendered by this component.
  • fill: It is used to indicate whether the tag should take up the full width of its container or not.
  • htmlTitle: It is used to denote the HTML title to be passed to the component.
  • icon: It is used to denote the name of an icon or an icon element to render before the children.
  • intent: It is used to denote the visual intent color to apply to the element.
  • interactive: It is used to indicate whether the tag should visually respond to user interactions or not.
  • large: It is used to indicate whether this tag should use large styles or not.
  • minimal: It is used to indicate whether this tag should use minimal styles or not.
  • multiline: It is used to indicate whether tag content should be allowed to occupy multiple lines or not.
  • onClick: It is a callback that is triggered when the tag is clicked.
  • onRemove: It is a click handler for the remove button.
  • rightIcon: It is used to denote the name of an icon or an icon element to render after the children.
  • round: It is used to indicate whether this tag should have rounded ends or not.

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

Creating React Project:

Step 1: To create a react app, you need to install react modules through 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 different Tag Component Props.

App.js




import React from 'react'
import '@blueprintjs/core/lib/css/blueprint.css';
import { Tag } from "@blueprintjs/core";
export default function App() {
  
    return (
        <div style={{ margin: 100 }}>
            <h1 style={{ color: 'green' }}>
                GeeksforGeeks
            </h1>
            <h3><u>
                React.js BluePrint Tag Component Props
            </u></h3>
            <div>
                <Tag icon={"home"} round large minimal>
                    Welcome to GFG</Tag>
                <br></br> <br></br>
                <Tag round large>Code</Tag>
                <br /> <br />
                <Tag round large>Learn</Tag>
                <br /><br />
                <Tag round large>Practice</Tag>
                <br /><br />
            </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 Tag Component Props.

App.js




import React from 'react'
import '@blueprintjs/core/lib/css/blueprint.css';
import { Tag } from "@blueprintjs/core";
export default function App() {
  
    return (
        <div style={{ margin: 100 }}>
            <h1 style={{ color: 'green' }}>
                GeeksforGeeks
            </h1>
              
            <h3><u>
                React.js BluePrint Tag Component Props
            </u></h3>
              
            <Tag round large intent="success">
                Data Structures and Algorithms - Self Paced
            </Tag>
            <br /><br />
            <Tag round large intent="warning">
                Course Description
            </Tag>
            <br /><br />
            <Tag round large fill minimal multiline>
                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. Start 
                Today!
            </Tag>
        </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/tag.props



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