React Suite Button group
React Suite is a front-end library that consists of a set of React components that makes it easier for developers to build beautiful and responsive websites faster. In this article, we will be discussing React Suite Button group. The ButtonGroup component is used to group the buttons together in a group.
React Suite Button Group Components:
- Button: This is the most basic button component.
- ButtonGroup: This component is used to group the Buttons together.
React Suite Button Groups Props:
- size: This property of the ButtonGroup component is used to change the size of all buttons in the group. It accepts four values: xs, sm, md and lg.
<ButtonGroup> <Button>...</Button> <Button>...</Button> </ButtonGroup>
Creating React Application And Installing Module:
Step 1: Create a React application using the following command:
npx create-react-app foldername
Step 2: Move to the newly created project folder using the following command:
Step 3: After creating the ReactJS application, Install the required modules ( rsuite in this case ) using the following command:
npm install rsuite
Project Structure: After completing the above steps, the project structure will look like the following:
Example 1: Now write down the following code in the App.js file. Here, App is our default component. In this example, we made two button groups using the ButtonGroup component provided by the rsuite library.
Step to Run Application: Run the application using the following command from the root directory of the project:
Output: Now open your browser and go to http://localhost:3000/, you will see the following output:
Example 2: In this example, we used the size property of the ButtonGroup component to change the size of all buttons in the group.