How to use ButtonGroup Component in ReactJS? Last Updated : 23 Jul, 2024 Summarize Comments Improve Suggest changes Share 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 ReactJS Reactstrap ButtonGroup Component G gouravhammad Follow Improve Article Tags : 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 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 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 ReactJS Onsen UI Button Component ReactJS Onsen-UI is a popular front-end library with a set of React components designed to develop HTML5 hybrid and mobile web apps beautifully and efficiently. Button Component allows the user to take actions, and make choices, with a single tap. We can use the following approach in ReactJS to use 2 min read ReactJS UI Ant Design Button Component Ant Design Library has this component pre-built, and it is very easy to integrate as well. Button Component provides a way for users to take actions, and make choices, with a single tap. We can use the following approach in ReactJS to use the Ant Design Button Component. Button Props: danger: It is 2 min read ReactJS Blueprint ButtonGroup Component 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. ButtonGroup Component provides a way for users to arrange multiple buttons in a horizontal or vertical group. We can use the f 2 min read Like