React Suite Button Color
React Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products. The Button component is used to fire an action when the user clicks the button. In this article, we will be discussing the React Suite Button Color. To change the color of the Button the color property is used.
React Suite Button Color Components:
- Button: This is the most basic component used to create a button.
React Suite Button Color Props:
- color: This property of the Button component is used to change the color of the button. The color property can have any one of seven values: red, orange, yellow, green, cyan, blue, or violet.
- appearance: This property is used to change the appearance of the button component. It can have any of the five values: default, primary, link, subtle, or ghost.
<Button color="red">Red Button</Button>
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 module ( 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 the following example, we used the Button component’s color property to modify the Button’s color.
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: This example shows the use of Button color property with different appearances of buttons.