ReactJS MDBootstrap Progress Component
MDBootstrap is a Material Design and bootstrap-based react UI library that is used to make good-looking webpages with its seamless and easy-to-use component. In this article, we will know how to use Progress Component in ReactJS MDBootstrap.
The Progress component is used to depict the progress of any task which is being carried out.
Properties:
- tag: It is used to define the tag of the MDBProgress element
- className: It is used to add custom classes to MDBProgressBar element
- height: It is used to set the height of the MDBProgress and MDBProgressBar elements
Syntax:
<MDBProgress> <MDBProgressBar width={50} ></MDBProgressBar> </MDBProgress>
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: Install ReactJS MDBootstrap in your given directory.
npm i mdb-ui-kit npm i mdb-react-ui-kit
Step 4: Import the element to be used in the project.
import { MDBProgress } from 'mdb-react-ui-kit'
Project Structure: It will look like the following.
Step to Run Application: Run the application from the root directory of the project, using the following command.
npm start
Example 1: This is the basic example that shows how to use Progress Component.
App.js
import React from "react" ; import { MDBProgress, MDBProgressBar } from "mdb-react-ui-kit" ; export default function App() { return ( <div id= "gfg" > <h2>w3wiki</h2> <h4>ReactJS MDBootstrap Progress component</h4> <MDBProgress> <MDBProgressBar width={45} valuemin={40} valuemax={60}> 45% </MDBProgressBar> </MDBProgress> </div> ); } |
Output:
Example 2: In this example, we will know how to use the bgColor property in a spinner component
App.js
import React from "react" ; import { MDBProgress, MDBProgressBar } from "mdb-react-ui-kit" ; export default function App() { return ( <div id= "gfg" > <h2>w3wiki</h2> <h4>ReactJS MDBootstrap Progress component</h4> <MDBProgress height={20}> <MDBProgressBar bgColor= 'success' width={35} valuemin={0} valuemax={100}> 35% </MDBProgressBar> </MDBProgress> <br /> <MDBProgress height={20}> <MDBProgressBar bgColor= 'danger' width={45} valuemin={0} valuemax={100}> 45% </MDBProgressBar> </MDBProgress> <br /> <MDBProgress height={20}> <MDBProgressBar bgColor= 'warning' width={33} valuemin={0} valuemax={100}> 33% </MDBProgressBar> </MDBProgress> <br /> <MDBProgress height={20}> <MDBProgressBar bgColor= 'primary' width={62} valuemin={0} valuemax={100}> 62% </MDBProgressBar> </MDBProgress> </div> ); } |
Output:
Example 3: In this example, we will know how to use striped and animated properties in a spinner component
App.js
import React from "react" ; import { MDBProgress, MDBProgressBar } from "mdb-react-ui-kit" ; export default function App() { return ( <div id= "gfg" > <h2>w3wiki</h2> <h4>ReactJS MDBootstrap Progress component</h4> <MDBProgress height={30}> <MDBProgressBar striped bgColor= 'success' width={35} valuemin={0} valuemax={100}> 35% </MDBProgressBar> </MDBProgress> <br /> <MDBProgress height={30}> <MDBProgressBar striped animated bgColor= 'danger' width={45} valuemin={0} valuemax={100}> 45% </MDBProgressBar> </MDBProgress> </div> ); } |
Output:
Reference: https://mdbootstrap.com/docs/b5/react/components/progress/
Contact Us