Skip to content

CdsProgressBar

A linear progress indicator — a horizontal bar for the course of an operation: a file upload, the steps of a wizard, media playback. The value comes from model-value, and when the course of the operation is unknown, the indeterminate mode turns on a running waiting animation.

Storybook GitLab Figma
Test coverage: 100% — good coverage
API in specs
30 / 30 props, events, slots and exposed members with a test
Test cases
53 unit · 0 browser
Known bugs
4 pinned by an it.fails test
Code coverage
100% lines · 95.5% branches measured in v4.0.0-alpha.13
A11y (axe)
19 recommendations in 17 stories measured in v4.0.0-alpha.11

For progress shown as a ring take CdsProgressCircle, and to dim a container while it loads — CdsOverlay.

Anatomy ​

The bar is built from three layers: the indicator of the current value, the buffer and the background. The content of the default slot is drawn on top of the layers. By default the background and the buffer are tinted with the color of the indicator at a high transparency — the intensity is tuned by the bg-opacity and buffer-opacity props.

Variations ​

Value ​

The model-value prop is the current progress. The bar counts from 0 to max (100 by default), so you can pass raw values — seconds or megabytes — without converting them into percent. A change of the value is animated with a smooth transition, and reverse fills the bar from right to left.

Indeterminate progress ​

The indeterminate prop turns on the running animation — use it when the course of the operation is unknown and there is no percentage to show.

Buffer ​

The buffer-value prop is a second bar between the indicator and the background: the part that is already prepared but not passed yet — a preloaded fragment of a video, for example. To make the buffer readable against the bar, raise buffer-opacity; a separate color comes from buffer-color.

The stream prop adds a dashed animation from the edge of the buffer to the end of the bar — a signal that the data keeps coming. The edge of the stream is set by buffer-value, and the background is hidden.

Height ​

The height prop sets the height of the bar in pixels. The default is 4.

Rounding ​

The rounded-bar prop rounds the leading edge of the indicator. The start stays straight — the bar reads as continuous from the zero mark.

Colors ​

The color prop paints the indicator and — as long as separate colors are not set — the buffer and the background too. Your own background color comes from bg-color, and the transparency of the layers from opacity for the indicator and bg-opacity for the background.

Stripes ​

The striped prop lays running diagonal stripes over the indicator — they bring long operations with a known course to life.

Segments ​

The chunk-count prop splits the bar into equal segments — by the number of steps, for example — while chunk-width builds segments of a fixed width. The gap between them comes from chunk-gap. The indicator fills segments whole: the value snaps to the edge of the nearest segment.

The variant="split" option does not cut the bar into pieces but separates the filled part from the rest with a single gap — the indicator and the background read as two independent segments.

Content ​

The default slot renders content in the center of the bar and receives the value and buffer slot props — normalized percentages. Increase height so that the content fits.

Guidelines ​

Scenarios ​

File upload ​

The button starts the upload: the bar grows as the data arrives, and the caption above it shows the file and the percentage. The green color supports the positive scenario, and once it is done the button offers to upload again.

Wizard steps ​

chunk-count set to the number of steps turns the bar into a wizard indicator: filled segments are the steps behind, semi-transparent ones are the steps ahead. The value is the share of the current step out of the total.

Seeking a video ​

The clickable prop turns the bar into a control: a click writes the new value into v-model. The buffer shows the preloaded fragment, stream shows that the loading continues, and the captions compute the time from the percentages.

Refreshing the data in a card ​

The absolute prop pins the bar to the top edge of a container with position: relative — the indicator does not push the content around. The active prop hides the bar by smoothly collapsing its height to zero, and indeterminate spares you from measuring the progress of a background operation.

API ​

Props

NameTypeDefaultDescription
absoluteboolean | undefined—Absolute positioning of the component
activeboolean | undefinedtrueControls the active state of the progress bar
activeColorstring | undefined—Color of the component in its active state
baseColorstring | undefined—Color of the component in its inactive state
bgColorstring | undefined—Background color of the component
bgOpacitystring | number | undefined—Opacity of the progress bar background
bufferColorstring | undefined—Color of the buffer part of the progress bar
bufferOpacitystring | number | undefined—Opacity of the buffer part of the progress bar
bufferValuestring | number | undefined0Buffer value of the progress
chunkCountstring | number | undefinednullNumber of segments the progress bar is split into
chunkGapstring | number | undefined4Gap between the segments of the progress bar
chunkWidthstring | number | undefinednullWidth of a single segment of the progress bar
clickableboolean | undefined—Makes the progress bar clickable
colorstring | undefined—Component color
heightstring | number | undefined4Height of the progress bar
indeterminateboolean | undefined—Indeterminate progress state with no fixed value
locationAnchor | null | undefined'top'Position of the element relative to its container, for example "top left", "center", "bottom right".
maxstring | number | undefined100Maximum progress value
modelValuestring | number | undefined0Current progress value
opacitystring | number | undefined—Opacity of the main progress indicator
reverseboolean | undefined—Fills the progress bar in the opposite direction
roundedBarboolean | undefined—Rounds the progress indicator
streamboolean | undefined—Shows a streaming animation over the progress indicator
stripedboolean | undefined—Shows stripes on the progress indicator
tagstring | JSXComponent<any> | undefined'div'Custom HTML tag or component to render
textColorstring | undefined—Text color of the component
themestring | undefined—Component theme
variant"split" | undefined—Display variant of the progress bar segments

Events

NameTypeDescription
update:modelValue[value: number]Fires when the progress value changes — on a click on the bar in the clickable mode

Slots

NameTypeDescription
default{ value: number; buffer: number; }Content above the bar — a caption with the percentage, for example. The params carry the current value and the buffer value