Skip to content
Related Articles

Related Articles

React Suite <Progress.Circle> Props

View Discussion
Improve Article
Save Article
  • Last Updated : 23 Jun, 2022
View Discussion
Improve Article
Save Article

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. Progress is used to indicate user task is completed or at what stage it is currently on.

<Progress.Circle> Props:

  • classPrefix: ‘progress’ denote the prefix of the component CSS class.
  • gapDegree: Gap Degree of half-circle range from 0 to 360.
  • gapPosition: ‘right’ , ‘top’ , ‘bottom’ , ‘left’ denotes notch position.
  • percent: The percentage of the circular progress is shown through this.
  • showInfo: It is used to specify whether text will be shown or not in circular progress.
  • status: ‘success’ , ‘fail’ , ‘active’ denotes circular progress status.
  • strokeColor: It is used to specify the color of the circular progress.
  • strokeWidth: It is used to specify the line width of the circular progress.
  • strokeLineCap: ’round’ , ‘square’ , and ‘butt’ denotes the end of open paths. 
  • trailColor: It is used to specify the color of the circular progress trail.
  • trailWidth: It is used to specify the trail width of the circular progress.

Approach: Let us create a React project and install React Suite module. Then we will create a UI that will create a React Progress Circle with its Props.

Creating React Project:

Step 1: To create a react app, you need to install react modules through npx command. “npx” is used instead of “npm” because you will be needing this command in your app’s lifecycle only once.

npx create-react-app project_name

Step 2: After creating your react project, move into the folder to perform different operations.

cd project_name

Step 3: After creating the ReactJS application, Install the required module using the following command:

npm install rsuite

Project Structure: After running the commands mentioned in the above steps, if you open the project in an editor you can see a similar project structure as shown below. The new component user makes or the code changes, we will be performing will be done in the source folder.

Project Structure

Example 1: We are creating a UI that shows React Suite Circle Progress. We will display all the 3 status fail active and pass using progress.circle string class prefix and status prop.

Filename: App.js

Javascript




import React from "react";
import { Progress } from 'rsuite';
import '../node_modules/rsuite/dist/rsuite.min.css';
  
const myStyle = {
    width: 120,
    display: 'inline-block',
    marginRight: 10
};
  
class App extends React.Component {
    render() {
        return (
            <div style={{ margin: 100 }}>
                <h3 style={{ color: "green" }}>
                    Geeks for Geeks
                </h3>
                  
                <h6>React Suite Circular Progress</h6><br />
                  
                <div style={myStyle}> 
                    <Progress.Circle 
                    percent={20} status="fail" />
                </div>
                <div style={myStyle}> 
                    <Progress.Circle 
                    percent={50} status="active" />
                </div>
                <div style={myStyle}> 
                    <Progress.Circle 
                    percent={100} status="success" />
                </div>
            </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:

Circular Progress

Example 2: We are creating a UI that shows different React Suite Circle Progress using progress.circle string class prefix and its different props.

Filename: App.js

Javascript




import React from "react";
import { Progress } from 'rsuite';
import '../node_modules/rsuite/dist/rsuite.min.css';
  
const myStyle = {
    width: 120,
    display: 'inline-block',
    marginRight: 10
};
  
class App extends React.Component {
    render() {
        return (
            <div style={{ margin: 100 }}>
                <h3 style={{ color: "green" }}>
                    Geeks for Geeks
                </h3>
                  
                <h6>React Suite Circular Progress</h6><br />
                  
                <div style={myStyle}> 
                    <Progress.Circle percent={60}
                    strokeColor="green" strokeWidth={5} 
                    trailWidth={5} trailColor="blue" />
                </div>
  
                <div style={myStyle}>
                    <Progress.Circle percent={80} 
                    strokeColor="yellow"
                    strokeWidth={3} trailWidth={3} 
                    trailColor="orange" />
                </div>
            </div>
        );
    }
}
  
export default App;

Output: Now open your browser and go to http://localhost:3000/, you will see the following output:

Circular Progress

Reference: https://rsuitejs.com/components/progress/#code-lt-progress-circle-gt-code 


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!