DwsProgressBar
API ReferenceLinear
A linear bar fills its container and shows the percentage after the bar. Color resolves through the theme's CSS variables; AriaLabel names what is in progress.
Show Code
ProgressBar.razor
<DwsProgressBar Name='ProgressBarDemo_Linear_Primary' Progress='60' />
<DwsProgressBar Name='ProgressBarDemo_Linear_Success' Progress='85' Color='DwsColor.Success' AriaLabel='Upload of report.pdf' />
<DwsProgressBar Name='ProgressBarDemo_Linear_Warning' Progress='40' Color='DwsColor.Warning' AriaLabel='Disk usage' />
<DwsProgressBar Name='ProgressBarDemo_Linear_Error' Progress='15' Color='DwsColor.Error' />Without a label
ShowLabel='false' hides the percentage; the value stays available to screen readers.
Show Code
ProgressBar.razor
<DwsProgressBar Name='ProgressBarDemo_Linear_NoLabel' Progress='70' Color='DwsColor.Info' ShowLabel='false' />Circular
ProgressBarType='DwsProgressBarType.Circular' draws the value as an arc with the label in the centre.
Show Code
ProgressBar.razor
<div class='d-flex flex-wrap gap-3'>
<DwsProgressBar Name='ProgressBarDemo_Circular_Primary' Progress='75' ProgressBarType='DwsProgressBarType.Circular' />
<DwsProgressBar Name='ProgressBarDemo_Circular_Success' Progress='50' ProgressBarType='DwsProgressBarType.Circular' Color='DwsColor.Success' />
<DwsProgressBar Name='ProgressBarDemo_Circular_Error' Progress='30' ProgressBarType='DwsProgressBarType.Circular' Color='DwsColor.Error' />
<DwsProgressBar Name='ProgressBarDemo_Circular_Warning' Progress='90' ProgressBarType='DwsProgressBarType.Circular' Color='DwsColor.Warning' />
<DwsProgressBar Name='ProgressBarDemo_Circular_Info' Progress='10' ProgressBarType='DwsProgressBarType.Circular' Color='DwsColor.Info' />
</div>Indeterminate
IsIndeterminate animates the bar for work of unknown length. The percentage is hidden in this mode, but a custom Label is still shown. A Label without placeholders is a caption: it also becomes the bar's accessible name, so the two labelled bars below are announced as 'Loading...' and 'Syncing' instead of the generic 'Loading'; AriaLabel still wins when set.
Show Code
ProgressBar.razor
<DwsProgressBar Name='ProgressBarDemo_Indeterminate_Linear' IsIndeterminate='true' />
<DwsProgressBar Name='ProgressBarDemo_Indeterminate_LinearLabel' IsIndeterminate='true' Color='DwsColor.Success' Label='Loading...' />
<div class='d-flex flex-wrap gap-3'>
<DwsProgressBar Name='ProgressBarDemo_Indeterminate_Circular' IsIndeterminate='true' ProgressBarType='DwsProgressBarType.Circular' />
<DwsProgressBar Name='ProgressBarDemo_Indeterminate_CircularLabel' IsIndeterminate='true' ProgressBarType='DwsProgressBarType.Circular'
Color='DwsColor.Secondary' Label='Syncing' />
</div>Custom range
Min and Max replace the 0-100 range; the label still shows the percentage of that range.
Show Code
ProgressBar.razor
<DwsProgressBar Name='ProgressBarDemo_Range_Negative' Min='-20' Max='40' Progress='18' Color='DwsColor.Warning' />
<DwsProgressBar Name='ProgressBarDemo_Range_Fraction' Min='0' Max='1' Progress='0.64' ProgressBarType='DwsProgressBarType.Circular' Color='DwsColor.Info' />Label format
Label replaces the percentage and is a format string: {0} percent, {1} value, {2} Min, {3} Max, formatted with the current culture.
Show Code
ProgressBar.razor
<DwsProgressBar Name='ProgressBarDemo_Range_Upload' Min='0' Max='40' Progress='12.5' Label='{1:0.0} of {3} MB' />
<DwsProgressBar Name='ProgressBarDemo_Range_Steps' Min='0' Max='5' Progress='3' Color='DwsColor.Success' Label='Step {1} of {3}' />
<DwsProgressBar Name='ProgressBarDemo_Range_Temperature' Min='-20' Max='40' Progress='18' Color='DwsColor.Warning' Label='{1} °C' />
<DwsProgressBar Name='ProgressBarDemo_Range_Quota' Min='0' Max='1' Progress='0.64' ProgressBarType='DwsProgressBarType.Circular'
Color='DwsColor.Info' Label='{0}% used' />Buffer
Linear bars can show a secondary Buffer value behind the progress - for example how much of a video is loaded ahead of the playback position.
Show Code
ProgressBar.razor
<DwsProgressBar Name='ProgressBarDemo_Buffer' Progress='@_playback' Buffer='@_buffered' Label='{1:0}s / {3}s' />
<div class='d-flex align-items-center gap-2 mt-2'>
<DwsButton Name='ProgressBarDemo_Buffer_Play' Appearance='DwsAppearance.Outline' ButtonSize='DwsSize.Small' OnClick='AdvancePlayback'>Play 10s</DwsButton>
<DwsButton Name='ProgressBarDemo_Buffer_Reset' Appearance='DwsAppearance.Outline' ButtonSize='DwsSize.Small' OnClick='ResetPlayback'>Reset</DwsButton>
</div>ProgressBar.razor.cs
private double _playback = 20;
private double _buffered = 45;
private void AdvancePlayback()
{
_playback = Math.Min(_playback + 10, 100);
_buffered = Math.Min(Math.Max(_buffered, _playback) + 15, 100);
}
private void ResetPlayback()
{
_playback = 20;
_buffered = 45;
}Sizes
Size sets the bar height of linear bars and the diameter of circular ones.
Show Code
ProgressBar.razor
<DwsProgressBar Name='ProgressBarDemo_Size_LinearXSmall' Progress='30' Size='DwsSize.XSmall' />
<DwsProgressBar Name='ProgressBarDemo_Size_LinearSmall' Progress='45' Size='DwsSize.Small' />
<DwsProgressBar Name='ProgressBarDemo_Size_LinearMedium' Progress='60' Size='DwsSize.Medium' />
<DwsProgressBar Name='ProgressBarDemo_Size_LinearLarge' Progress='75' Size='DwsSize.Large' />
<DwsProgressBar Name='ProgressBarDemo_Size_LinearXLarge' Progress='90' Size='DwsSize.XLarge' />
<div class='d-flex flex-wrap align-items-center gap-3'>
<DwsProgressBar Name='ProgressBarDemo_Size_CircularXSmall' Progress='30' ProgressBarType='DwsProgressBarType.Circular' Size='DwsSize.XSmall' ShowLabel='false' />
<DwsProgressBar Name='ProgressBarDemo_Size_CircularSmall' Progress='45' ProgressBarType='DwsProgressBarType.Circular' Size='DwsSize.Small' />
<DwsProgressBar Name='ProgressBarDemo_Size_CircularMedium' Progress='60' ProgressBarType='DwsProgressBarType.Circular' Size='DwsSize.Medium' />
<DwsProgressBar Name='ProgressBarDemo_Size_CircularLarge' Progress='75' ProgressBarType='DwsProgressBarType.Circular' Size='DwsSize.Large' />
<DwsProgressBar Name='ProgressBarDemo_Size_CircularXLarge' Progress='90' ProgressBarType='DwsProgressBarType.Circular' Size='DwsSize.XLarge' />
</div>Custom sizes
Width and Height (px) size a linear bar, Radius (px) a circular one. They override Size and the breakpoint sizes.
Show Code
ProgressBar.razor
<DwsProgressBar Name='ProgressBarDemo_Custom_Linear' Progress='55' Width='320' Height='18' Color='DwsColor.Success' />
<div class='d-flex flex-wrap align-items-center gap-3'>
<DwsProgressBar Name='ProgressBarDemo_Custom_CircularSmall' Progress='40' ProgressBarType='DwsProgressBarType.Circular' Radius='36' />
<DwsProgressBar Name='ProgressBarDemo_Custom_CircularLarge' Progress='80' ProgressBarType='DwsProgressBarType.Circular' Radius='64' Color='DwsColor.Success' />
</div>Responsive sizing
SizeSm to SizeXxl change the size from a breakpoint up (576, 768, 992, 1200 and 1400px) - resize the window to see them switch.
Show Code
ProgressBar.razor
<DwsProgressBar Name='ProgressBarDemo_Responsive_Linear' Progress='65'
Size='DwsSize.XSmall' SizeMd='DwsSize.Medium' SizeXl='DwsSize.XLarge' />
<DwsProgressBar Name='ProgressBarDemo_Responsive_Circular' Progress='65' ProgressBarType='DwsProgressBarType.Circular'
Size='DwsSize.Small' SizeMd='DwsSize.Medium' SizeXl='DwsSize.Large' />Adaptive sizing
Adaptive makes a circular bar take the width of its container (here three columns of a 480px row), and its label scales with it.
Show Code
ProgressBar.razor
<div class='row' style='max-width: 480px;'>
<div class='col-3'>
<DwsProgressBar Name='ProgressBarDemo_Adaptive_Quarter' Progress='25' ProgressBarType='DwsProgressBarType.Circular' Adaptive='true' />
</div>
<div class='col-4'>
<DwsProgressBar Name='ProgressBarDemo_Adaptive_Third' Progress='50' ProgressBarType='DwsProgressBarType.Circular' Adaptive='true' Color='DwsColor.Success' />
</div>
<div class='col-5'>
<DwsProgressBar Name='ProgressBarDemo_Adaptive_Rest' Progress='75' ProgressBarType='DwsProgressBarType.Circular' Adaptive='true' Color='DwsColor.Info' />
</div>
</div>Disabled
A disabled bar - by parameter or by page permission - is dimmed and desaturated but keeps its value.
Show Code
ProgressBar.razor
<DwsProgressBar Name='ProgressBarDemo_Disabled_Linear' Progress='45' Disabled='true' />
<DwsProgressBar Name='ProgressBarDemo_Disabled_Circular' Progress='45' ProgressBarType='DwsProgressBarType.Circular' Color='DwsColor.Success' Disabled='true' />Segments
Segments draws several named, coloured parts one after the other; the bar's value is their sum. The legend (ShowSegmentLegend, on by default) says what each colour is, and screen readers hear every part in the value text. Circular bars draw the parts as consecutive arcs.
Show Code
ProgressBar.razor
<DwsProgressBar Name='ProgressBarDemo_Segments_Linear' Label='Import' AriaLabel='Import of 200 files' Max='200' Segments='_importSegments' Size='DwsSize.Large' />
<div class='d-flex align-items-center gap-2 mt-2'>
<DwsButton Name='ProgressBarDemo_Segments_Advance' Appearance='DwsAppearance.Outline' ButtonSize='DwsSize.Small' OnClick='AdvanceImport'>Import 20 more</DwsButton>
<DwsButton Name='ProgressBarDemo_Segments_Reset' Appearance='DwsAppearance.Outline' ButtonSize='DwsSize.Small' OnClick='ResetImport'>Reset</DwsButton>
</div>
<div class='mt-3'>
<DwsProgressBar Name='ProgressBarDemo_Segments_Circular' ProgressBarType='DwsProgressBarType.Circular' AriaLabel='Disk usage' Segments='_diskSegments' />
</div>ProgressBar.razor.cs
// Values are in the units of the bar's Min-Max range (here: files, Max = 200).
private readonly List<DwsProgressSegment> _importSegments =
[
new("Imported", 60, DwsColor.Success),
new("Skipped", 20, DwsColor.Warning),
new("Failed", 10, DwsColor.Error),
];
private readonly List<DwsProgressSegment> _diskSegments =
[
new("Documents", 35, DwsColor.Primary),
new("Media", 30, DwsColor.Info),
new("System", 15, DwsColor.Secondary),
];
private void AdvanceImport()
{
double left = 200 - _importSegments.Sum(segment => segment.Value);
double step = Math.Min(20, left);
// The list is changed in place; the page re-renders after the click and the bar reads it again.
_importSegments[0].Value += step * 0.7;
_importSegments[1].Value += step * 0.2;
_importSegments[2].Value += step * 0.1;
}
private void ResetImport()
{
_importSegments[0].Value = 60;
_importSegments[1].Value = 20;
_importSegments[2].Value = 10;
}Segments without a legend
ShowSegmentLegend='false' leaves the legend out; screen readers still hear every part in the value text.
Show Code
ProgressBar.razor
<DwsProgressBar Name='ProgressBarDemo_Segments_NoLegend' AriaLabel='Disk usage without legend' Segments='_diskSegments' ShowSegmentLegend='false' />ProgressBar.razor.cs
private readonly List<DwsProgressSegment> _diskSegments =
[
new("Documents", 35, DwsColor.Primary),
new("Media", 30, DwsColor.Info),
new("System", 15, DwsColor.Secondary),
];Interface-Description
| Name | Typ | Default | Description |
|---|---|---|---|
| EstimatedTimeRemaining | TimeSpan? | null | The current estimate of the time left; null when there is none. |
| Name | Typ | Default | Description |
|---|---|---|---|
| Progress | double | 0 | The current progress, in the range Min to Max. Values outside the range are drawn clamped to it. Ignored while IsIndeterminate is set. |
| AriaLabel | string? | null | The accessible name - what is in progress ("Upload of report.pdf"). Left empty, a Label without placeholders (a caption such as "Uploading report.pdf") is used as the name; only a bar with neither is announced as the generic localized "Progress" / "Loading". |
| Min | double | 0 | The value that represents an empty bar. |
| Max | double | 100 | The value that represents a full bar. Must be greater than Min; otherwise the bar shows empty below Max and full at or above it, and a warning is logged. |
| Buffer | double? | null | Linear bars only: a secondary value in the same range as Progress, drawn as a lighter bar behind it. Not drawn while null or indeterminate. |
| ProgressBarType | DwsProgressBarType | DwsProgressBarType.Linear | Linear bar or circular arc. |
| IsIndeterminate | bool | false | Animates the bar for work of unknown length instead of showing a value. Only a custom Label is shown in this mode. |
| ShowLabel | bool | true | Shows the label - after the bar for linear bars, in the centre for circular ones. |
| Label | string? | null | Custom label in place of the localized percentage, e.g. "Loading...". A composite format string: {0} percent (whole number), {1} value, {2} Min, {3} Max, formatted with the current culture. Double a brace to write it literally. A malformed format is shown as written and logged. |
| Color | DwsColor | DwsColor.Primary | Bar color, resolved through the theme's CSS variables. Track and buffer are lighter mixes of it. |
| Size | DwsSize | DwsSize.Medium | Bar height of linear bars (XSmall 2px, Small 4px, Medium 7px, Large 10px, XLarge 14px) and diameter of circular ones (32px, 50px, 100px, 150px, 200px). Applies below the first breakpoint size that is set. |
| SizeSm | DwsSize? | null | Size on viewports 576px wide and up. Falls back to Size when null. |
| SizeMd | DwsSize? | null | Size on viewports 768px wide and up. Falls back to the next smaller breakpoint size when null. |
| SizeLg | DwsSize? | null | Size on viewports 992px wide and up. Falls back to the next smaller breakpoint size when null. |
| SizeXl | DwsSize? | null | Size on viewports 1200px wide and up. Falls back to the next smaller breakpoint size when null. |
| SizeXxl | DwsSize? | null | Size on viewports 1400px wide and up. Falls back to the next smaller breakpoint size when null. |
| Width | double? | null | Linear bars only: total width in px, label included. Left null, the bar fills its container. |
| Height | double? | null | Linear bars only: bar height in px. Overrides Size and the breakpoint sizes. |
| Radius | double? | null | Circular bars only: radius in px. Overrides Size and the breakpoint sizes. |
| Adaptive | bool | false | Circular bars take the full width of their container and the label scales with them. Overrides Size, the breakpoint sizes and Radius. Linear bars always fill their container unless Width is set. |
| Segments | IReadOnlyList<DwsProgressSegment>? | null | Segmented progress: named, coloured parts (Name, Value in the units of Min-Max, Color) drawn one after the other - consecutive arcs on a circular bar. The bar's value is then their sum (Progress is ignored), and the accessible value text lists every part with its share. Segments that together exceed the range are cut at its end. Not drawn while indeterminate. |
| ShowSegmentLegend | bool | true | Shows a legend below a segmented bar: swatch, name and share of every segment. |
| ShowEstimatedTime | bool | false | Shows an estimate of the time left ("About 2 minutes left"), computed from how fast the value has been rising since it first changed. Appears once there is a rate; goes when the bar is full, indeterminate or its value falls (a new run). |
| AnnounceEstimatedTime | bool | true | Whether screen readers hear the estimate: politely (a role="status" region after the bar), when its wording changes and at most every EstimatedTimeAnnounceInterval seconds. |
| EstimatedTimeAnnounceInterval | int | 15 | Least number of seconds between two announcements of the estimate. |
| Name | Typ | Description |
|---|---|---|
| OnEstimatedTimeChanged | EventCallback<TimeSpan?> | Raised when the estimate of the time left changes; null when there is none any more. |
| OnProgressChanged | EventCallback<DwsProgressBarChangedEventArgs> | Raised when Progress changes after the first render, with the previous value, the new value and the new percentage. Not raised for the initial value or when only Min/Max change. |
| OnCompleted | EventCallback | Raised when Progress reaches Max from below. A bar that starts full does not raise it; one that drops and fills again raises it again. |
| Name | Typ | Default | Description |
|---|---|---|---|
| Element | ElementReference | The associated web component. May be null if accessed before the component is rendered. | |
| ComponentGuid | Guid | Unique identifier for the component. | |
| TypeString | string | The name of the component type, obtained from reflection. | |
| Authorized_RegisterEnabled | bool | false | Indicates whether this component is enabled through a permission registry. |
| Authorized_RegisterSelected | bool | false | Indicates whether this component is selected in permission selection mode. |
| GetInitializedState | bool | false | Returns whether the component is initialized. |
| GetRenderModeState | DwsRenderMode | Returns the current render mode. | |
| GetComponentState | DwsComponentStateType | Returns the current component state. | |
| GetIsInteractiveState | bool | false | Returns whether the component is interactive. |
| GetIsPrerenderingState | bool | false | Returns whether the component is prerendering. |
| GetComponentLoadingState | bool | false | Returns whether the component is loading. |
| IsFormBusy | bool | false | Whether the DwsForm (or DwsFormBusyRegion) around the component is locked because its submit handler is running. The state itself is the cascaded FormBusyState (IDwsFormBusyState). |
| Name | Typ | Parameters | Description |
|---|---|---|---|
| DebugInfo | void | Logs debug information about the component. | |
| UpdateState | void | Updates the component's state and triggers StateHasChanged. | |
| UpdateStateAsync | Task | Asynchronously updates the component's state and triggers StateHasChanged. | |
| Dispose | void | Disposes the component and releases resources. | |
| FocusAsync | ValueTask | bool containedInScrollableList | Sets focus to the component's element. |
| Name | Typ | Default | Description |
|---|---|---|---|
| Name | string | Required unique identifier for the component within its container. | |
| Visible | bool | true | Determines if the component is visible in the UI. |
| Disabled | bool | false | Disables the form control, ensuring it doesn't participate in form submission. |
| ComponentNameSpace | string | The namespace for permission-based access control. | |
| PermissionKey | string? | null | A stable key that takes the place of Name in the generated permission namespace (Page.PermissionKey): the stored permission survives a rename, and components that share a key share one permission entry. Null: keyed by Name. Read once, when the component registers; an explicit ComponentNameSpace wins. |
| Class | string | Optional CSS class names. | |
| Style | string | Optional in-line styles. | |
| Tag | object | An optional user-defined object to store any additional data with the component. | |
| BackReference | DwsReference | A reference to the enclosing component. | |
| ID | string | The HTML ID attribute for the component. | |
| AdditionalAttributes | Dictionary<string, object> | Additional HTML attributes for the root element (role="progressbar"). aria-label and aria-valuetext passed here replace the defaults; id, class, style, role and aria-valuemin/max/now are controlled by the component. | |
| IgnorePermissionChecks | bool | false | Bypasses all permission checks for this component. |
| IgnorePermissionSelection | bool | false | Ignore permission selection mode for this component. |
| IgnoreFormBusy | bool | false | Takes the component out of the submit lock of the DwsForm (or DwsFormBusyRegion) around it: IsFormBusy stays false for it. |
| Name | Typ | Description |
|---|---|---|
| OnInitializedCallbackStarted | EventCallback | Callback when OnInitialized starts. |
| OnInitializedCallback | EventCallback | Callback during OnInitialized. |
| OnInitializedCallbackCompleted | EventCallback | Callback when OnInitialized completes. |
| OnInitializedAsyncCallbackStarted | EventCallback | Callback when OnInitializedAsync starts. |
| OnInitializedAsyncCallback | EventCallback | Callback during OnInitializedAsync. |
| OnInitializedAsyncCallbackCompleted | EventCallback | Callback when OnInitializedAsync completes. |
| OnIsComponentLoadingChanged | EventCallback<bool> | Callback when IsComponentLoading changes. |
| OnCurrentRenderModeChanged | EventCallback<DwsRenderMode> | Callback when CurrentRenderMode changes. |
| OnComponentStateChanged | EventCallback<DwsComponentStateType> | Callback when ComponentState changes. |
