React Suite Loading Button
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 on it.
In this article, we will be seeing React Suite Loading button. The loading button is used to give the virtual cue to the user that something is loading. To change a normal button to the Loading Button the loading property of the Button component is used.
React Suite Button Loading Components:
- Button: This is the most basic button component used to display a simple button.
React Suite Button Loading Props:
- loading: It is a boolean property of the Button component used to show a loading button.
- 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.
<Button loading> ... </Button>
Note: The child component of the Button won’t be visible when the button is in a loading state.
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 this example, we used the loading property of the Button component to show the loading button.
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 color property along with the loading property of the button to change the color of the Loading Button.
Please Login to comment...