React Progress Bar - Flowbite
The progress bar component is used to show the completion rate of a given task in the form of a filled bar where you can also add a label indicating percentage
Use the progress bar component from Flowbite React to show the percentage and completion rate of a given task using a visually friendly bar meter based on multiple styles and sizes.
Choose one of the examples below for your application and use the React props to update the progress fill rate, label, sizing, and colors and customize with the classes from Tailwind CSS.
To start using the progress bar component make sure you import it first from Flowbite React:
'use client';
import { Progress } from 'flowbite-react';
Default progress bar
Use this example to show a progress bar where you can set the progress rate using the progress
prop from React which should be a number from 1 to 100.
- React TypeScript
'use client';
import { Progress } from 'flowbite-react';
export default function DefaultProgress() {
return (
<Progress progress={45} />
)
}
Progress bar with labels
Use this example to show a progress bar with a label. You can set the label text using the textLabel
prop and the progress text using the labelText
prop.
- React TypeScript
'use client';
import { Progress } from 'flowbite-react';
export default function WithLabels() {
return (
<Progress
labelProgress
labelText
progress={50}
size="lg"
textLabel="Flowbite"
/>
)
}
Label positioning
This example shows how you can position the label text inside the progress bar by using the React props called progressLabelPosition
and textLabelPosition
on the <Progress>
component in React.
- React TypeScript
'use client';
import { Progress } from 'flowbite-react';
export default function LabelPositions() {
return (
<Progress
labelProgress
labelText
progress={45}
progressLabelPosition="inside"
size="lg"
textLabel="Flowbite"
textLabelPosition="outside"
/>
)
}
Sizing
The size
prop from React can be used on the <Progress>
component to set the size of the progress bar. You can choose from sm
, md
, lg
and xl
.
- React TypeScript
'use client';
import { Progress } from 'flowbite-react';
export default function Sizing() {
return (
<div className="flex flex-col gap-2">
<div className="text-base font-medium dark:text-white">
Small
</div>
<Progress
color="dark"
progress={45}
size="sm"
/>
<div className="text-base font-medium dark:text-white">
Default
</div>
<Progress
color="dark"
progress={45}
size="md"
/>
<div className="text-lg font-medium dark:text-white">
Large
</div>
<Progress
color="dark"
progress={45}
size="lg"
/>
<div className="text-lg font-medium dark:text-white">
Extra Large
</div>
<Progress
color="dark"
progress={45}
size="xl"
/>
</div>
)
}
Colors
Set your own custom colors for the progress bar component by using the color
prop from React and the utility classes from Tailwind CSS.
- React TypeScript
'use client';
import { Progress } from 'flowbite-react';
export default function Colors() {
return (
<div className="flex flex-col gap-2">
<div className="text-base font-medium">
Dark
</div>
<Progress
color="dark"
progress={45}
/>
<div className="text-base font-medium text-cyan-700">
Blue
</div>
<Progress
color="blue"
progress={45}
/>
<div className="text-base font-medium text-red-700">
Red
</div>
<Progress
color="red"
progress={45}
/>
<div className="text-base font-medium text-green-700">
Green
</div>
<Progress
color="green"
progress={45}
/>
<div className="text-base font-medium text-yellow-700">
Yellow
</div>
<Progress
color="yellow"
progress={45}
/>
<div className="text-base font-medium text-indigo-700">
Indigo
</div>
<Progress
color="indigo"
progress={45}
/>
<div className="text-base font-medium text-purple-700">
Purple
</div>
<Progress
color="purple"
progress={45}
/>
</div>
)
}