React Suite Loading Button
Last Updated :
11 Jun, 2022
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.
Syntax:
<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:
cd foldername
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:
Project Structure
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.
JavaScript
import React from "react";
import { Button } from "rsuite";
// Default CSS
import "rsuite/dist/rsuite.min.css";
function App() {
const ButtonStyle = { margin: "0px 20px" };
return (
<div className="App" style={{ textAlign: "center",
padding: "0 30px" }}>
<header style={{ display: "block",
marginBottom: "20px" }}>
<h3 style={{ color: "green" }}>
GeeksforGeeks</h3>
<h5>React Suite Button Loading</h5>
</header>
<Button loading style={ButtonStyle}>
Loading Button 1</Button>
<Button loading appearance="primary"
style={ButtonStyle}>Loading Button 2</Button>
</div >
);
}
export default App;
Step to Run Application: Run the application using the following command from the root directory of the project:
npm start
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.
JavaScript
import React from "react";
import { Button } from "rsuite";
// Default CSS
import "rsuite/dist/rsuite.min.css";
function App() {
const ButtonStyle = { margin: "10px 10px" };
return (
<div className="App" style={{ textAlign: "center",
padding: "0 30px" }}>
<header style={{ display: "block",
marginBottom: "20px" }}>
<h3 style={{ color: "green" }}>
GeeksforGeeks</h3>
<h5>React Suite Button Loading - Color Variation</h5>
</header>
<Button loading color="red" appearance="primary"
style={ButtonStyle}>
Red Loading Button
</Button>
<Button loading color="violet" appearance="primary"
style={ButtonStyle}>
Violet Loading Button
</Button>
<Button loading color="green" appearance="primary"
style={ButtonStyle}>
Green Loading Button
</Button>
<Button loading color="yellow" appearance="primary"
style={ButtonStyle}>
Yellow Loading Button
</Button>
<br />
<Button loading color="orange" appearance="primary"
style={ButtonStyle}>
Ornage Loading Button
</Button>
<Button loading color="blue" appearance="primary"
style={ButtonStyle}>
Blue Loading Button
</Button>
<Button loading color="cyan" appearance="primary"
style={ButtonStyle}>
Cyan Loading Button
</Button>
</div >
);
}
export default App;
Output:
Reference: https://rsuitejs.com/components/button/#loading
Similar Reads
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 th
3 min read
React Suite Button Icon
React Suite Button Icon allows to use of an Icon as a Button. The Button component is used to fire an action when the user clicks the button. React Suite Button IconButton Icon component is used when we want to use an icon as a button, It has an icon property that is used to specify the icon of the
3 min read
React Suite Button Active
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 learning about the React Suite Button Active. To mak
3 min read
React Suite Button Size
React Suite is a front-end library designed for the middle platform and back-end products. Button Component allows the user to interact with the webpage. The Button Component has a number of properties of its own like appearance, size, color, etc. Here we will look into the size property. Size Prop
2 min read
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
3 min read
React Suite Button ts:Color Props
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. ts:Color props are used to provide different colors to the Buttons. It provides d
2 min read
React Suite Buttons Props
React Suite is a front-end library designed for the middle platform and back-end products. Button Component allows the user to interact with the webpage. The Button Component has a number of properties of its own like appearance, size, color, etc. The props are: active: It is a boolean value. It de
4 min read
React Suite Button Component
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. 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 the React Suite Button
3 min read
React Suite Split 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. Button Component allows the user to take actions, and make choices, with a single tap. There are different ways to define a button. A split button is used to mak
3 min read
React Suite Button toolbar
React suite is a library of React components, sensible UI design, and a friendly development experience. It is supported in all major browsers. It provides pre-built components of React which can be used easily in any web application. In this article, we'll learn about React suite Button toolbar. A
3 min read