A progress bar, used to show the progress of a task.
---import { Progress } from 'studiocms:ui/components';---
<Progress id="progress" max={100} value={50} />
Similar to the native HTML <progress>
element, the Progress
component takes two props: value
and max
. The value
prop represents the current progress, while the max
prop represents the maximum value of the progress bar.
The value and max can be adjusted after the component has been initialized by using the ProgressHelper
, which takes in the ID of the progress bar as the only argument:
---import { Progress } from 'studiocms:ui/components';---
<Progress id="progress" max={100} value={50} /><script> import { ProgressHelper } from 'studiocms:ui/components';
const progress = new ProgressHelper('progress'); progress.setValue(75); progress.setMax(150);
// You can obtain the value, max and percentage of the progress bar progress.getValue(); // 75 progress.getMax(); // 150 progress.getPercentage(); // 50</script>
The progress component can be colored with all the colors available in the theme by setting the color
prop to one of the following values:
primary
success
warning
danger
info
monochrome
---import { Progress } from 'studiocms:ui/components';---
<Progress id="progress-1" max={100} value={50} color="primary" /><Progress id="progress-2" max={100} value={50} color="success" /><Progress id="progress-3" max={100} value={50} color="warning" /><Progress id="progress-4" max={100} value={50} color="danger" /><Progress id="progress-5" max={100} value={50} color="info" /><Progress id="progress-6" max={100} value={50} color="monochrome" />