Open In App

React.js Blueprint Button group Component Props

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. Menu Component provides a way for users to display lists of interactive items. 

The Button directly supports the ButtonGroup props. If we set these props on ButtonGroup, this will apply the same value to all buttons in the group. Most of the modifiers, which are enabled on the group, cannot be overridden on child buttons.



Button group props:

Starting with react app:



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

Project Structure: It will look like the following:

 

Example 1: Write the following code in app.js. Set fill = “true” and vertical = “true”




import React from 'react'
import '@blueprintjs/core/lib/css/blueprint.css';
import { ButtonGroup, Button, AnchorButton } from "@blueprintjs/core";
  
function App() {
    return (
        <div style={{
            display: 'block', width: 400, padding: 30
        }}>
            <h1 style={{ color: 'green' }}>GeeksforGeeks</h1>
            <h4>React.js Blueprint Button group Component CSS</h4>
  
            <ButtonGroup fill={true} vertical={true} >
                <Button icon="database">
                    Queries</Button>
                <Button icon="function">
                    Functions</Button>
                <AnchorButton rightIcon="caret-down">
                    Options</AnchorButton>
            </ButtonGroup>
        </div >
    );
}
  
export default App;

Steps to run the application: Follow the following steps to run the application:

npm start

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

 

Example 2: Write the following code in app.js. Set minimal = “true” 




import React from 'react'
import '@blueprintjs/core/lib/css/blueprint.css';
import { ButtonGroup, Button, AnchorButton } from "@blueprintjs/core";
  
function App() {
    return (
        <div style={{
            display: 'block', width: 400, padding: 30
        }}>
            <h1 style={{ color: 'green' }}>GeeksforGeeks</h1>
            <h4>React.js Blueprint Button group Component CSS</h4>
  
            <ButtonGroup minimal={true} >
                <Button icon="database">
                    Queries</Button>
                <Button icon="function">
                    Functions</Button>
                <AnchorButton rightIcon="caret-down">
                    Options</AnchorButton>
            </ButtonGroup>
  
        </div >
    );
}
  
export default App;

Steps to run the application: Follow the following steps to run the application:

npm start

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

 

Reference: https://blueprintjs.com/docs/#core/components/button-group.props


Article Tags :