Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

ReactJS UI Ant Design Progress Component

  • Last Updated : 01 Jun, 2021

Ant Design Library has this component pre-built, and it is very easy to integrate as well. Progress Component is used to display the current progress of an operation flow. We can use the following approach in ReactJS to use the Ant Design Progress Component.

Progress Props:

  • format: It is used as the template function of the content.
  • percent: It is used to set the completion percentage.
  • showInfo: It is used to indicate whether to display the progress value and the status icon or not.
  • status: It is used to set the status of the Progress.
  • strokeColor: It is used to denote the progress bar color.
  • strokeLinecap: It is used to set the progress linecap style.
  • success: It is used for the configs of the successful progress bar.
  • trailColor: It is used to set the unfilled part color.
  • type: It is used to set the type.

type=”line” Props:

  • steps: It is used to denote the total set count.
  • strokeColor: It is used to denote the progress bar color.
  • strokeWidth: It is used to set the progress bar width.

type=”circle” Props:

  • strokeColor: It is used to denote the circular progress color.
  • strokeWidth: It is used to set the circular progress width.
  • width: It is used to set the canvas width of the circular progress.

type=”dashboard” Props:

  • gapDegree: It is used to denote the gap degree of the half-circle.
  • gapPosition: It is used to denote the gap position.
  • strokeWidth: It is used to set the dashboard progress width.
  • width: It is used to set the canvas width of the dashboard progress.

Creating React Application And Installing Module:

  • Step 1: Create a React application using the following command:

    npx create-react-app foldername
  • Step 2: After creating your project folder i.e. foldername, move to it using the following command:

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

    npm install antd

Project Structure: It will look like the following.

Project Structure

Example: Now write down the following code in the App.js file. Here, App is our default component where we have written our code.

App.js




import React from 'react'
import "antd/dist/antd.css";
import { Progress } from 'antd';
  
export default function App() {
  
  return (
    <div style={{
      display: 'block', width: 700, padding: 30
    }}>
      <h4>ReactJS Ant-Design Progress Component</h4>
      <Progress percent={40} />
      <Progress type="circle" percent={40} />
    </div>
  );
}

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:

Reference: https://ant.design/components/progress/

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!