For progress shown as a horizontal bar take CdsProgressBar, and to dim a container while it loads — CdsOverlay.
Variations
Value
The model-value prop is the current progress in percent, from 0 to 100. A change of the value is animated with a smooth transition of the arc.
The rotate prop turns the starting point of the arc by the given number of degrees. By default the progress grows clockwise from "12 o'clock".
Indeterminate progress
The indeterminate prop turns on an endless animation — use it when the course of the operation is unknown. The value disable-shrink leaves only the rotation without the pulsation of the arc: this animation is simpler and does not load the main thread. It is also enabled automatically for users with the prefers-reduced-motion setting.
Sizes
The size prop sets the diameter: from xs to xl or a number in pixels. The default size is md.
Stroke
The width prop sets the thickness of the stroke in pixels regardless of the diameter.
The rounded prop rounds the ends of the arc.
Colors
The color prop paints the progress arc, bg-color paints the background ring underneath. Both accept color tokens of the design system.
Content
The default slot renders content in the center of the ring and receives the current value through the value slot prop — a handy way to show the percentage next to the arc.
Reveal animation
The reveal prop animates the arc from zero to the current value when the component appears. The duration is configured with an object: :reveal="{ duration: 1500 }".
Guidelines
Scenarios
File upload
The upload progress is visible in the center of the ring through the default slot, and once it is done the percentage turns into a success icon. The rounded prop softens the arc, and color supports the positive scenario.
A filling quota
The ring shows not only a process but also a static value — the used storage space, for example. A computed color switches the indicator from green to yellow and red as the limit approaches.
A background operation
A compact indeterminate indicator of the xs size sits in a line with the text and reports that the operation that was started is still running. The caption next to it explains what to expect — without it a spinning ring says nothing.
API
Props
| Name | Type | Default | Description |
|---|---|---|---|
bgColor | string | undefined | — | Background color of the loader |
color | string | undefined | — | Color of the loader |
indeterminate | boolean | "disable-shrink" | undefined | — | Shows the animation continuously; use it when the course of the loading is unknown. The string disable-shrink switches to a simpler animation that does not run on the main thread |
modelValue | string | number | undefined | 0 | Current loading progress in percent |
reveal | boolean | { duration?: number | undefined; } | undefined | false | Animates the indicator from zero to the current value when the component appears. The { duration } object sets the animation duration in milliseconds |
rotate | string | number | undefined | 0 | Turns the starting point of the circle by the given number of degrees |
rounded | boolean | undefined | — | Rounds the ends of the progress arc |
size | number | "xs" | "sm" | "md" | "lg" | "xl" | undefined | 'md' | Size of the component |
tag | string | JSXComponent<any> | undefined | 'div' | Custom HTML tag or component to render |
theme | string | undefined | — | Component theme |
width | string | number | undefined | 4 | Sets the thickness of the circle stroke in pixels |
Slots
| Name | Type | Description |
|---|---|---|
default | { value: number; } | Default slot. Carries the progress value of the loading indicator. |