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
| Name | Type | Default | Description |
|---|---|---|---|
absolute | boolean | undefined | — | Absolute positioning of the component |
active | boolean | undefined | true | Controls the active state of the progress bar |
activeColor | string | undefined | — | Color of the component in its active state |
baseColor | string | undefined | — | Color of the component in its inactive state |
bgColor | string | undefined | — | Background color of the component |
bgOpacity | string | number | undefined | — | Opacity of the progress bar background |
bufferColor | string | undefined | — | Color of the buffer part of the progress bar |
bufferOpacity | string | number | undefined | — | Opacity of the buffer part of the progress bar |
bufferValue | string | number | undefined | 0 | Buffer value of the progress |
chunkCount | string | number | undefined | null | Number of segments the progress bar is split into |
chunkGap | string | number | undefined | 4 | Gap between the segments of the progress bar |
chunkWidth | string | number | undefined | null | Width of a single segment of the progress bar |
clickable | boolean | undefined | — | Makes the progress bar clickable |
color | string | undefined | — | Component color |
height | string | number | undefined | 4 | Height of the progress bar |
indeterminate | boolean | undefined | — | Indeterminate progress state with no fixed value |
location | Anchor | null | undefined | 'top' | Position of the element relative to its container, for example "top left", "center", "bottom right". |
max | string | number | undefined | 100 | Maximum progress value |
modelValue | string | number | undefined | 0 | Current progress value |
opacity | string | number | undefined | — | Opacity of the main progress indicator |
reverse | boolean | undefined | — | Fills the progress bar in the opposite direction |
roundedBar | boolean | undefined | — | Rounds the progress indicator |
stream | boolean | undefined | — | Shows a streaming animation over the progress indicator |
striped | boolean | undefined | — | Shows stripes on the progress indicator |
tag | string | JSXComponent<any> | undefined | 'div' | Custom HTML tag or component to render |
textColor | string | undefined | — | Text color of the component |
theme | string | undefined | — | Component theme |
variant | "split" | undefined | — | Display variant of the progress bar segments |
Events
| Name | Type | Description |
|---|---|---|
update:modelValue | [value: number] | Fires when the progress value changes — on a click on the bar in the clickable mode |
Slots
| Name | Type | Description |
|---|---|---|
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 |