Progress
Indeterminate
Fractional value / max
Invalid range (falls back to a 0% bar, not NaN)
Documentation
A linear progress bar showing task completion or usage. The value prop controls the filled portion relative to max. When showLabel is true, a percentage text is displayed next to the bar. Setting value to a negative number activates an indeterminate sliding animation for unknown-duration tasks. For a circular ring instead of a linear bar — e.g. a compact dashboard stat tile — use Gauge instead (it has no indeterminate mode, since a ring reads awkwardly as "unknown duration").
Usage
<script>
import { Progress } from '@juspay/svelte-ui-components';
</script>
<Progress value={60} />
Use leadingLabel for a fixed caption before the track. It is independent of
showLabel, which renders the computed percentage after the track:
<Progress value={level} max={1} ariaLabel="Microphone level">
{#snippet leadingLabel()}LVL{/snippet}
</Progress>
Pass animateValue alongside showLabel to have the percentage count up to its new value with AnimatedNumber instead of jumping straight there, for a bar whose value updates in place rather than mounting fresh each time:
<script>
import { Progress } from '@juspay/svelte-ui-components';
let uploaded = $state(60);
</script>
<Progress value={uploaded} showLabel animateValue />
<button onclick={() => (uploaded = Math.min(100, uploaded + 7))}>+7%</button>
Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
| value | number |
Yes | - |
Current progress value (0 to max). Values are clamped to the 0-max range. A negative value activates the indeterminate animation for unknown-duration tasks. A non-finite value (e.g. NaN) is treated as an invalid range -- see max below. |
| max | number |
No | 100 |
The maximum value representing 100% completion. The filled percentage is calculated as (value / max) * 100. max must be finite and positive; a zero, negative, or non-finite max (or a non-finite value) is an invalid range and renders the bar at 0% instead of NaN. |
| leadingLabel | Snippet |
No | - |
Content before the track inside the progress container (for example a fixed caption). Independent of showLabel, which renders after the track. |
| showLabel | boolean |
No | false |
Whether to display the rounded percentage text next to the progress bar. Hidden during indeterminate mode. |
| animateValue | boolean |
No | false |
Renders the showLabel percentage through AnimatedNumber so it counts to its new value instead of jumping. No effect unless showLabel is also true, and silently inert in indeterminate mode, since there is no percentage there to animate towards. |
| ariaLabel | string |
No | - |
Accessible name for the progress bar. Falls back to the same percentage text as showLabel (e.g. "75%") when determinate, or "Loading" when indeterminate. |
| headerStart | Snippet |
No | - |
Left end of a header row above the track (e.g. the name). Layout only; unset with headerEnd and note, nothing changes. |
| headerEnd | Snippet |
No | - |
Right end of that header row (e.g. the value text). |
| note | Snippet |
No | - |
A line under the track (e.g. "resets in 2h"). |
| testId | string |
No | - |
Value for the data-pw attribute, used for end-to-end testing selectors. |
| classes | string |
No | - |
CSS class string applied to the component's top-level element. Useful for theming — define classes with CSS variable overrides and pass them to create variant styles. |
Accessibility
The root element sets role="progressbar" with aria-valuemin="0" and aria-valuemax="100" — these two are constant regardless of the raw value/max domain, so assistive technology always hears a plain 0-100 scale (matching the convention Gauge already uses). aria-valuenow itself is only well-defined for a valid range, i.e. a finite value and a finite, positive max; when it is, aria-valuenow is rounded to 2 decimal places rather than the nearest whole number, so it stays effectively in step with the bar's raw fractional width instead of drifting from what's visually shown (matching Gauge's convention of tying aria-valuenow to the raw computed value rather than the rounded display text); the separate showLabel text still rounds to the nearest whole percent, since that's the right precision for a human-readable label. For an invalid range (zero, negative, or non-finite max, or a non-finite value) the component does not propagate NaN into aria-valuenow or the label -- it falls back to a 0% determinate bar (aria-valuenow="0", label "0%") instead.
In indeterminate mode (value < 0) aria-valuenow is omitted entirely per the WAI-ARIA progressbar pattern, and aria-valuetext="indeterminate" plus aria-busy="true" are set instead, so assistive technology announces the unknown-duration state rather than reading it as stuck at a fixed value. aria-valuemin/aria-valuemax are kept in both modes — the 0-100 scale itself isn't unknown, only the current position within it is.
Use the ariaLabel prop to give the bar an accessible name describing what it measures (e.g. "File upload progress"). When omitted, it falls back to the same percentage text showLabel displays (or "Loading" while indeterminate, matching the aria-label LoadingDots already uses for its own loading state), so assistive technology always announces a name even if you forget to set one explicitly.
CSS Variables
Override these custom properties to theme the component.
| Variable | Default | CSS Property | Description |
|---|---|---|---|
--progress-container-width |
100% |
width | Width of the outer container holding the track and label. |
--progress-container-padding |
0 |
padding | Padding around the progress container. |
--progress-container-gap |
8px |
gap | Gap between the track and the percentage label. |
--progress-root-gap |
5px |
gap | Gap between the header row and the track row. Only present when headerStart, headerEnd or note is passed. |
--progress-header-gap |
8px |
gap | Gap between headerStart and headerEnd within the header row. |
--progress-track-flex |
1 |
flex | Flex grow/shrink/basis of the track. Set 0 0 auto when using a fixed track width. |
--progress-track-width |
auto |
width | Width of the track itself (separate from the outer container, which also holds labels). |
--progress-track-height |
8px |
height | Height of the background track. |
--progress-track-background |
#e0e0e0 |
background | Background color of the unfilled track. |
--progress-track-border-radius |
4px |
border-radius | Corner rounding of the track. |
--progress-bar-background |
#2196f3 |
background | Background color of the filled bar. |
--progress-bar-border-radius |
4px |
border-radius | Corner rounding of the filled bar. |
--progress-bar-transition |
width 0.3s ease |
transition | Transition applied when the bar width changes. |
--progress-indeterminate-duration |
1.5s |
animation-duration | Duration of one cycle of the indeterminate sliding animation. |
--progress-indeterminate-reduced-motion-opacity |
0.5 |
opacity | Static opacity shown instead of the sliding animation under prefers-reduced-motion: reduce. |
--progress-label-font-size |
14px |
font-size | Font size of the percentage label. |
--progress-label-font-weight |
500 |
font-weight | Font weight of the percentage label. |
--progress-label-color |
#333 |
color | Text color of the percentage label. |
--progress-label-font-family |
inherit |
font-family | Font family of the percentage label. |
--progress-label-margin |
0 |
margin | Margin around the percentage label. |
Web Component
Tag: <sui-progress>
<sui-progress value="60" max="100" show-label></sui-progress>
Slots
| Slot Name | Maps to Snippet | Description |
|---|---|---|
leading-label |
leadingLabel |
Content before the track. Nothing renders when the slot is empty. |
header-start |
headerStart |
Left end of the header row. The header row exists only when this slot or header-end is filled. |
header-end |
headerEnd |
Right end of the header row. |
note |
note |
Row after the progressbar. |
The element claims each snippet only when that slot is filled, because supplying it is what creates the header or note row. A JavaScript-assigned snippet still applies when its slot is empty.
Segmented tracks and trailing labels
Pass segments to opt into complete-segment fill (rounded upward). The continuous
track remains the default, and negative values retain the existing indeterminate
track even when segments are requested. Segment counts must be positive and are
bounded to 1,000. A trailingLabel snippet replaces the percentage display without
adding a wrapper; leadingLabel remains independent.
<Progress value={40} segments={3} ariaLabel="Product tour">
{#snippet leadingLabel()}<span>02</span>{/snippet}
{#snippet trailingLabel()}<span>03</span>{/snippet}
</Progress>
| Token | Default | Purpose |
|---|---|---|
--progress-segment-gap |
4px |
Gap between segments |
--progress-segment-padding |
0 |
Optional track inset |
--progress-segment-height |
track height / 8px |
Segment height |
--progress-segment-border-radius |
radius / 4px |
Segment rounding |
--progress-segment-transition |
background-color 0.3s ease |
Fill transition |
Track and bar background tokens still provide passive/filled colors. Segment fill
transitions stop under reduced motion. <sui-progress> supports the segments
attribute and trailing-label slot. aria-label is forwarded through the
progressAriaLabel adapter without replacing the native host accessor.