Open In App

ReactJS UI Ant Design Steps Component

Last Updated : 19 May, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

Ant Design Library has this component pre-built, and it is very easy to integrate as well. Steps Component is a kind of navigation bar that is helpful in a way that it guides users through the steps of a task. We can use the following approach in ReactJS to use the Ant Design Steps Component.

Syntax:

<Steps current={ }>
  <Step title=" " 
           description=" " />
  <Step title=" " 
           description=" " />
</Steps>

Steps Props:

  • className: It is used to define the additional class for this component.
  • current: It is used to set the current step by counting from 0.
  • direction: It is used to specify the direction of the step bar, vertical or horizontal.
  • initial: It is used to set the initial step by counting from 0.
  • labelPlacement: It is used to place title and description in a vertical or horizontal direction.
  • percent: It is used to denote the progress circle percentage of the current step in process status.
  • progressDot: It is used to apply the steps with the progress dot style.
  • responsive: It is used to change to vertical direction when the screen width is smaller than 532 pixels.
  • size: It is used to specify the size of the step bar.
  • status: It is used to specify the status of the current step.
  • type: It is used to denote the type of steps.
  • onChange: It is a callback function that is trigger when the step is changed.

Steps.Step Props:

  • description: It is used to define the description of the step.
  • disabled: It is used to disable the click event.
  • icon: It is used to define the icon of the step.
  • status: It is used to specify the status.
  • subTitle: It is used to denote the subtitle of the step.
  • title: It is used to denote the title of the step.

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. folder name, 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 { Steps } from 'antd';
  
const { Step } = Steps;
export default function App() {
  
  return (
    <div style={{ display: 'block', width: 700, padding: 30 }}>
      <h4>ReactJS Ant-Design Steps Component</h4>
      <Steps current={1}>
        <Step title="Waiting" 
              description="Waiting for the resources" />
        <Step title="Finished" 
              description="Finished my second step" />
        <Step title="In Progress" 
              description="Work under progress" />
      </Steps>
    </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/steps/



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads