Open In App

React Suite <Progress.Line> Props

Last Updated : 23 Jun, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

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 allows the user to display the progress of the components.

<Progress.Line> Props:

  • classPrefix: ‘progress’ denote the prefix of the component CSS class.
  • percent: The percentage of the line progress is shown through this.
  • showInfo: It is used to specify whether the text will be shown or not in line progress.
  • status: ‘success’, ‘fail’, ‘active’ denotes line progress status.
  • strokeColor: It is used to specify the color of the line progress.
  • strokeWidth: It is used to specify the line width of the line progress.
  • vertical: It is used to specify if line progress is vertical or not.

Approach: Let us create a React project and install React Suite module. Then we will create a UI that will create a React Progress Line 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 different React Suite Line Progress with its props. 

Filename: App.js

Javascript




import React from "react";
import { Progress, Divider } from 'rsuite';
import '../node_modules/rsuite/dist/rsuite.min.css';
  
class App extends React.Component {
  render() {
    return (
      <div style={{ margin: 100 }}>
        <Progress.Line percent={40} strokeColor="yellow" />
        <Divider>Line Progress with strokeColor yellow</Divider>
        <Progress.Line percent={80} status="active" />
        <Divider>Active Status Line Progress</Divider>
        <Progress.Line percent={100} status="success" />
        <Divider>Success Status Line Progress </Divider>
      </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:

React Suite Line Progress

Example 2:  We are creating a UI that shows different React Suite Vertical Line Progress with vertical prop

Filename: App.js

Javascript




import React from "react";
import { Progress } from 'rsuite';
import '../node_modules/rsuite/dist/rsuite.min.css';
  
class App extends React.Component {
  render() {
    return (
      <div style={{textAlign:"center",margin:30}}>
        <h3 style={{color:"green"}}>Geeks for Geeks</h3>
        <h6>React Suite Vertical Line Progress</h6><br />
        <Progress.Line vertical 
          percent={50} strokeColor="yellow" />
      </div>
    );
  }
}
  
export default App;


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

Vertical Line Progress

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



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads