Skip to content

ProgressBar

Used to display the progress status for a task in a horizontal bar.

import {
useEffect,
useState,
} from 'react';
// Import component
import { ProgressBar } from '@fintech-sandpit/ui/react';
// Import styles (optional)
// Please note that the CSS file contains the styles for both the ProgressBar and ProgressCircle components.
import '@fintech-sandpit/ui/style/components/progress.css';
const [value, setValue] = useState(51);
// Your logic to update the value goes here
// For example, you can use a timer to update the value every second
useEffect(() => {
() => {
const timer = setInterval(() => {
if (value < 100) {
setValue(value + 1);
}
}, 1000);
return () => {
clearInterval(timer);
};
},
[
value,
],
);
return (
<ProgressBar
colorScheme="primary"
value={value}
bordered
/>
);
NameTypeRequiredDefaultDescription
valuenumber | null—Controlled progress value, between 0 and 100 1
defaultValuenumber | null—Uncontrolled progress value, between 0 and 100 1
colorSchemeColorSchemeneutralProgress bar color scheme
sizeSizemdProgress bar size
borderedbooleanfalseWhether to show a border
ariaLabelstring—Aria label for the progress bar
ariaLabelledBystring—Aria labelled by for the progress bar
  1. If value is null, the progress will be indeterminate, causing the progress bar to spin indefinitely.
type ColorScheme = 'neutral' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger'
type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl'