How To Add Bootstrap Progress Bar In ReactJs

In this article, we will learn how to add a bootstrap progress bar in reactjs.

–First of all, we have create react application.

-Then import the bootstrap package in your project.

npm i bootstrap

-Now open your app.js file and add the below code:

import Reac,{useState} from 'react'

function App() {
    const [percentage, setPercentage] = useState('10');

    return (
            <input type='number' onChange={(e) => setPercentage(} />
            <div class="progress">
                <div class="progress-bar bg-success-custom" role="progressbar" style={{ width: `${percentage}%`, height: '4px' }}
                    aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div>

– We have set the progress bar values using the input field. when we change the input value, the value set in the percentage state.
– We have set the percentage value in the progress bar using style. So when the value changes progress bar changes.


Submit a Comment

Your email address will not be published. Required fields are marked *


Select Categories