Open In App

React Suite Steps Custom Icon

Last Updated : 17 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. Steps is a navigation bar that guides users through the steps of a task.

Custom Icon helps to add an icon to the title of the step rather than just a number. It enhances the attractiveness of the step and adds visual meaning to it.

Syntax:

<Steps current={1}>
   <Steps.Item title="Some Title" 
           icon={Some Icon} />
</Steps>

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 rsuite

Project Structure: It will look like the following.

 

Example 1: Now write down the following code in the App.js file. Here, App is our default component where we have written our code. In this example, we will create Steps for publishing an article on GFG using React suite Steps.

JavaScript




import react from 'react'
import Steps from 'rsuite/Steps';
import 'rsuite/dist/rsuite.min.css';
import ExploreIcon from '@rsuite/icons/Explore';
import InfoOutlineIcon from '@rsuite/icons/InfoOutline';
import ReviewPassIcon from '@rsuite/icons/ReviewPass';
import ReviewIcon from '@rsuite/icons/Review';
export default function App() {
    return (
        <div className="App">
            <h1 style={{ color: 'green' }}>GeeksforGeeks</h1>
            <h3>React Suite Steps Custom Icon</h3>
  
            <Steps current={0} >
                <Steps.Item title="Pick Article" 
                    icon={<ExploreIcon />} description=
                        "You need to pick the article" />
                <Steps.Item title="Pending Review" 
                    icon={<InfoOutlineIcon />}
                        description="Write article, 
                        and submit it for review" />
                <Steps.Item title="In-Review" 
                    icon={<ReviewIcon />}
                        description="Reviewers checks 
                        your article" />
                <Steps.Item title="Published" 
                    icon={<ReviewPassIcon />}
                        description="Article is published" />
            </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:

 

Example 2: In this example, we will provide some styling to the icon for eg change the color of the icons from black (default) to your favorite one

JavaScript




import react from 'react'
import Steps from 'rsuite/Steps';
import 'rsuite/dist/rsuite.min.css';
  
import ExploreIcon from '@rsuite/icons/Explore';
import InfoOutlineIcon from '@rsuite/icons/InfoOutline';
import ReviewPassIcon from '@rsuite/icons/ReviewPass';
import ReviewIcon from '@rsuite/icons/Review';
export default function App() {
    return (
        <div className="App">
            <h1 style={{ color: 'green' }}>GeeksforGeeks</h1>
            <h3>React Suite Steps Custom Icon</h3>
  
            <Steps  >
                <Steps.Item title="Step 1" 
                    icon={<ExploreIcon 
                    style={{ color: 'red' }} />}
                        description="I am Red step " />
                <Steps.Item title="Step 2" 
                    icon={<InfoOutlineIcon 
                    style={{ color: 'green' }} />}
                        description="I Green step " />
                <Steps.Item title="Step 3" 
                    icon={<ReviewIcon 
                    style={{ color: 'blue' }} />}
                        description="I Blue step " />
                <Steps.Item title="Step 4" 
                    icon={<ReviewPassIcon 
                    style={{ color: 'orange' }} />}
                        description="I Orange step " />
            </Steps>
  
  
        </div>
    );
}


Output:

 

Reference: https://rsuitejs.com/components/steps/#custom-icon



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

Similar Reads