How to use ButtonGroup Component in ReactJS? Last Updated : 23 Jul, 2024 Comments Improve Suggest changes Like Article Like Report The ButtonGroup component can be used to group related buttons. Material UI for React has this component available for us and it is very easy to integrate. We can use ButtonGroup Component in ReactJS using the following approach:Creating React Application And Installing Module:Step 1: Create a React application using the following command:npx create-react-app foldernameStep 2: After creating your project folder i.e. foldername, move to it using the following command:cd foldernameStep 3: After creating the ReactJS application, Install the material-ui modules using the following command:npm install @material-ui/coreProject Structure: It will look like the following.Project StructureApp.js: Now write down the following code in the App.js file. Here, App is our default component where we have written our code. JavaScript import React, { useState } from 'react'; import Button from '@material-ui/core/Button'; import ButtonGroup from '@material-ui/core/ButtonGroup'; const App = () => { const [message, setMessage] = useState('') return ( <div style={{ margin: 'auto', display: 'block', width: 'fit-content' }}> <h3>How to use GroupButton Component in ReactJS?</h3> <ButtonGroup color="primary" aria-label="outlined primary button group"> <Button onClick={()=> { setMessage('You just clicked First Button') }} >First Button</Button> <Button onClick={()=> { setMessage('You just clicked Second Button') }} >Second Button</Button> <Button onClick={()=> { setMessage('You just clicked Third Button') }} >Third Button</Button> </ButtonGroup> <h3>{message}</h3> </div> ); } export default App; Step to Run Application: Run the application using the following command from the root directory of the project:npm startOutput: Now open your browser and go to http://localhost:3000/, you will see the following output: Comment More infoAdvertise with us Next Article How to use ButtonGroup Component in ReactJS? gouravhammad Follow Improve Article Tags : JavaScript Web Technologies ReactJS Similar Reads How to use AvatarGroup Component in ReactJS? AvatarGroup Component is used to group multiple Avatars. It renders its children as a stack. Material UI for React has this component available for us, and it is very easy to integrate. We can use the AvatarGroup Component in ReactJS using the following approach. Prerequisites:NodeJS or NPMReactJSMa 2 min read How to use Badge Component in ReactJS? Badge generates a small badge to the top-right of its children component. Material UI for React has this component available for us, and it is very easy to integrate. We can use the Badge Component in ReactJS using the following approach. Prerequisites:NodeJS or NPMReact JSMaterial UISteps to Create 2 min read How to use Avatar Component in ReactJS? Avatars are found throughout material design with uses in everything from tables to dialog menus. Material UI for React has this component available for us, and it is very easy to integrate. We can use the Avatar Component in ReactJS using the following approach. Prerequisites:NodeJS or NPMReactJSSt 2 min read How to use Collapse Component in ReactJS ? ReactJS, a popular JavaScript library for building user interfaces, provides developers with a rich set of components to create interactive and dynamic web applications. One such component is the Collapse component, which allows you to hide and reveal content based on user interaction. In this artic 2 min read How to use CardMedia Component in ReactJS? The CardMedia Component enables users to incorporate media, such as photos or videos, into specific cards. Material UI for React provides a user-friendly integration of this component, making it straightforward to use. Prerequisite:React JSMaterial UISteps to Create React Application And Installing 2 min read How to use Button Component in Material UI ? Buttons allow users to take actions, and make choices, with a single tap. Material UI for React has this component available for us and it is very easy to integrate. We can use the Button component in ReactJS using the following approach. Creating React Application And Installing Module: Step 1: Cre 2 min read How To Use Modal Component In ReactJS? Modals are a popular UI component used to display content in a pop-up window like alerts, forms, or additional information. In ReactJS, there are multiple ways to implement a modal. In this article, we will discuss two common approaches: using reusable functional components and using the Material-UI 4 min read How to use List Component in ReactJS? Lists are continuous, vertical indexes of text or images. Material UI for React has this component available for us, and it is very easy to integrate. We can use the List Component in ReactJS using the following approach. Prerequisites:NodeJS or NPMReactJSSteps to Create the React Application And In 2 min read How to use Chip Component in React JS? Chips are compact elements that represent an input, attribute, or action. Material UI for React has this component available for us, and it is very easy to integrate. We can use the Chip Component in React JS using the following approach.Prerequisites:Node JS or NPMReact JSMaterial UISteps for Creat 2 min read ReactJS Reactstrap ButtonGroup Component Reactstrap is a popular front-end library that is easy to use React Bootstrap 4 components. This library contains the stateless React components for Bootstrap 4. ButtonGroup component is used to group related buttons together. This component is used when the user needs to show the buttons together a 3 min read Like