Progress
Progress
A bar, a ring or a gauge that reports how far along an operation is - or, indeterminate, that it is still running - to the eye and to assistive technology alike.
Notes
Prefer a determinate value wherever one exists - it is the difference between "working" and "stuck" - and keep Indeterminate for the moment the total is unknown.
Progress is never operated: nothing in it takes focus, so a cancel button belongs beside it. The sweep, the spinner and the travelling stripes slow down under prefers-reduced-motion.
Usage
Every example is live. Open its code to see exactly what produced the component running underneath.
Basic
Indeterminate
Thickness & diameter
Percent number
Value & range
Buffer
Rounded & striped
Segments
Reversed & vertical
Gauge
Meter
Accessibility
Custom colors
Cascading parameters
Color
Size
Style & Class
:root or an ancestor restyles every progress below it, and one on Style restyles a
single instance. They restyle the default, not a choice: a parameter that says the same thing - an
explicit Color or Size included - still wins.
RTL
CSS variables
The public custom properties this component reads off its root, for what no parameter covers.
Every variable is read with a fallback and never declared by the component, so it inherits like any other custom property:
set one on :root (or in a [bit-theme] block) to restyle every instance, on any ancestor to restyle the ones inside it,
or on the Style of one instance to restyle it - and any instance nested inside it, which inherits the value too; a parameter changes one alone,
as does the real CSS property on the instance's Style / Styles when that property does not inherit (opacity: 1 keeps
one disabled instance undimmed without undimming a disabled one inside it), while an inherited one such as color or
font-family also reaches the nested instances that do not set it themselves. Leave a variable unset and the component
falls back to the theme token beside it.
BitProgress CSS variables
| Name | Default value | Description |
|---|---|---|
| --bit-Progress-bar-color | --bit-clr-pri | Fill of the bar and stroke of the ring; the buffer and the stripes derive from it. The Color and BarColor parameters win over it. |
| --bit-Progress-bar-text-color | --bit-clr-pri-text | Color of a readout placed Inside the bar. The Color parameter wins over it. |
| --bit-Progress-track-color | --bit-clr-bg-sec | The unfilled part: the track, the ring behind the stroke and the ends of the sweep. TrackColor wins over it. |
| --bit-Progress-buffer-color | The bar color at 38% | The buffered second value, on the bar and on the ring. No parameter paints the buffer, so it wins over the tint Color and BarColor derive it from. |
| --bit-Progress-stripe-color | --bit-clr-bg-pri at 25% | The stripes of a Striped bar. |
| --bit-Progress-stripe-size | spacing(2) | Pitch of the stripes, which is also how far they travel in one cycle. |
| --bit-Progress-thickness | --bit-siz-track-sm (bar), --bit-siz-spinner-stroke (ring) | Height of the bar, width of a vertical one and stroke of the ring. The Size and Thickness parameters win over it. |
| --bit-Progress-radius | --bit-shp-radius-progress (--bit-shp-radius-none when segmented) | Corner radius of the track and the bar. The Shape and Rounded parameters win over it. |
| --bit-Progress-diameter | spacing(6.25) | Smallest diameter of the ring. The Size and Diameter parameters win over it. |
| --bit-Progress-length | spacing(20) | Height of a Vertical bar. Length wins over it. |
| --bit-Progress-transition-duration | --bit-mot-duration | How long the fill takes to follow a new value. Set it to 0s for a bar fed many times a second. Reduced motion collapses it unless ForceAnimation is set. |
| --bit-Progress-font-size | --bit-tpg-fs-sm | Text size of the label and of the readout beside the bar. The Size parameter wins over it. |
| --bit-Progress-label-color | --bit-clr-fg-pri | Color of the label. |
| --bit-Progress-label-font-weight | --bit-tpg-fw-regular | Weight of the label. |
| --bit-Progress-percent-color | --bit-clr-fg-pri (bar), --bit-clr-fg-sec (ring) | Color of the readout beside the bar or in the middle of the ring. |
| --bit-Progress-percent-font-size | A step of the type ramp per the size the ring is drawn at, --bit-tpg-fs-xs to --bit-tpg-fs-4xl | Text size of the readout in the middle of the ring. |
| --bit-Progress-description-color | --bit-clr-fg-sec | Color of the description. |
| --bit-Progress-description-font-size | --bit-tpg-fs-2xs | Text size of the description. The Size parameter wins over it. |
API
Every parameter, public member, sub-class and enum this component exposes.
BitProgress parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| AnnounceProgress | bool | false | Announces the progress to screen readers through a polite live region, once per AnnounceStep crossed and always at completion. |
| AnnounceStep | double | 25 | How far the progress has to advance, in percentage points, before it is announced again. The first value is recorded without announcement; zero or negative is treated as 25. |
| AriaValueText | string? | null | The value in words for screen readers ("3 of 10 files"), also what AnnounceProgress speaks. |
| BarColor | string? | null | The color of the bar as any CSS color, replacing the Color role. The ring, the buffer and the stripes follow it. It wins over --bit-Progress-bar-color; --bit-Progress-buffer-color still paints the buffer. |
| Buffer | double? | null | A fainter second value behind the bar, read on the same scale as Value (or as a percentage without one). Ignored while Indeterminate. |
| Circular | bool | false | Draws the progress as a ring instead of a bar. An indeterminate ring is a spinner. |
| Classes | BitProgressClassStyles? | null | Custom CSS classes for different parts of the BitProgress. |
| Color | BitColor? | null | The general color of the BitProgress. An explicit value wins over the --bit-Progress-bar-color and --bit-Progress-bar-text-color variables; left unset, the progress is primary unless they say otherwise. --bit-Progress-buffer-color still paints the buffer. |
| Delay | int | 0 | Milliseconds the progress stays hidden after it first renders, so a quick operation never flashes one. Its space is kept and it is hidden from assistive technology too. The window opens once, with the first render: giving a Delay to a progress already on screen does not hide it. |
| Description | string? | null | Text describing or supplementing the operation. |
| DescriptionTemplate | RenderFragment? | null | Custom template for describing or supplementing the operation. |
| Diameter | int? | null | The exact diameter of the ring in pixels. Unset, it follows the Size, growing only when Thickness times Radius asks for more. |
| GapDegree | double | 0 | Cuts a gap of this many degrees (0 to 295) out of the ring, turning it into a gauge. No effect on a bar. |
| GapPlacement | BitPlacement | BitPlacement.Bottom | Where the gauge gap sits. Reversed swaps Start and End. |
| Indeterminate | bool | false | Reports that something is running without saying how far: the bar sweeps and the ring spins. No value is published to assistive technology and the readout is hidden. |
| Label | string? | null | Label to display above the BitProgress. |
| LabelTemplate | RenderFragment? | null | Custom label template to display above the BitProgress. |
| Length | string? | null | The height of a Vertical bar, as a CSS length (10rem by default). |
| Max | double | 100 | The top of the range Value is read against. Ignored without a Value. |
| Meter | bool | false | Exposes the indicator with the meter role - a reading within a range, such as disk usage - instead of progressbar. An Indeterminate one stays a progressbar. |
| Min | double | 0 | The bottom of the range Value is read against. Ignored without a Value. |
| Percent | double | 0 | The completeness as a percentage between 0 and 100. Ignored when Value is set. |
| PercentNumberFormat | string | {0:F0} % | The composite format string of the readout, applied to the percentage on the current culture. |
| PercentNumberPosition | BitProgressPercentPosition | BitProgressPercentPosition.End | Where the readout of a bar sits: under it (End, Start, Center), on the label's row (Top) or on the bar (Inside). A ring always shows it in its middle. |
| PercentNumberTemplate | RenderFragment<double>? | null | Custom markup for the readout, receiving the percentage as its context. Shows the readout even without ShowPercentNumber. |
| Radius | int | 6 | The multiplier applied to Thickness to size the ring when no Diameter is set. |
| Reversed | bool | false | Fills from the end towards the start and turns the ring counter-clockwise. |
| Rounded | bool | false | Pill-shaped ends on the bar and round caps on the ring - the shorthand for a Pill Shape, which wins over it when set. Left off, the bar is not square: it takes the corner the theme gives a linear progress (--bit-shp-radius-progress - square under Fluent, rounded under the Fluent 2, Material and Cupertino presets), so Shape Square is what asks for a square one. |
| SegmentGap | int | 4 | The gap between two Segments, in pixels. |
| Segments | int? | null | Cuts the bar into this many equal segments. The value still fills continuously. No effect on a ring. |
| Shape | BitShape? | null | The corners of the track and the bar, and the stroke cap of the ring. Only Pill (a pill-shaped bar, a round cap), Rounded (the corner the theme gives a linear progress) and Square (sharp corners) are honoured; Circle falls back to the default. Supersedes Rounded when both are set. An explicit value wins over --bit-Progress-radius; left unset, the bar takes the theme's progress corner and a segmented one stays square, unless that variable says otherwise. |
| ShowPercentNumber | bool | false | Writes the percentage beside the bar or in the middle of the ring. Hidden while Indeterminate. |
| Size | BitSize? | null | The size of the BitProgress. An explicit value wins over the --bit-Progress-font-size, --bit-Progress-description-font-size, --bit-Progress-thickness and --bit-Progress-diameter variables; left unset, the progress keeps its own defaults - the thinnest track and ring stroke, the medium type - unless they say otherwise. |
| Striped | bool | false | Paints diagonal stripes over a determinate bar. |
| StripedAnimation | bool | false | Makes the stripes of a Striped bar travel. |
| Styles | BitProgressClassStyles? | null | Custom CSS Styles for different parts of the BitProgress. |
| Thickness | int? | null | The height of the bar, the width of a Vertical one and the stroke of the ring, in pixels. Unset, it follows the Size. |
| TrackColor | string? | null | The color of the unfilled part as any CSS color: the track, the ring behind the stroke and the ends of the sweep. |
| Value | double? | null | The completeness in the operation's own unit, read against Min and Max. Takes the place of Percent and is what assistive technology is given. |
| Vertical | bool | false | Stands the bar on its end, filling from the bottom up (top down when Reversed). Its height comes from Length. |
BitComponentBase parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| AriaLabel | string? | null | Gets or sets the accessible label for the component, used by assistive technologies. |
| Class | string? | null | Gets or sets the CSS class name(s) to apply to the rendered element. |
| Dir | BitDir? | null | Gets or sets the text directionality for the component's content. |
| Disabled | bool | false | Gets or sets a value indicating whether the component is disabled and cannot respond to user interaction. |
| ForceAnimation | bool | false | Gets or sets a value indicating whether the component's animations play at their full duration even when reduced motion is requested. |
| HtmlAttributes | Dictionary<string, object> | new Dictionary<string, object>() | Captures additional HTML attributes to be applied to the rendered element, in addition to the component's parameters. An attribute written on the component wins over an entry of the same name. |
| Id | string? | null | Gets or sets the unique identifier for the component's root element. |
| Style | string? | null | Gets or sets the CSS style string to apply to the rendered element. |
| TabIndex | string? | null | Gets or sets the tab order index for the component when navigating with the keyboard. |
| Visibility | BitVisibility | BitVisibility.Visible | Gets or sets the visibility state (visible, hidden, or collapsed) of the component. |
BitComponentBase public members
| Name | Type | Default value | Description |
|---|---|---|---|
| UniqueId | Guid | Guid.NewGuid() | Gets the readonly unique identifier for the component's root element, assigned when the component instance is constructed. |
| RootElement | ElementReference | Gets the reference to the root HTML element associated with this component. |
BitProgressClassStyles properties
| Name | Type | Default value | Description |
|---|---|---|---|
| Root | string? | null | Custom CSS classes/styles for the root element of the BitProgress. |
| Label | string? | null | Custom CSS classes/styles for the label of the BitProgress. |
| PercentNumber | string? | null | Custom CSS classes/styles for the percent number of the BitProgress. |
| BarContainer | string? | null | Custom CSS classes/styles for the bar container of the BitProgress. |
| Track | string? | null | Custom CSS classes/styles for the track of the BitProgress. |
| Buffer | string? | null | Custom CSS classes/styles for the buffer bar of the BitProgress. |
| Bar | string? | null | Custom CSS classes/styles for the bar of the BitProgress. |
| Description | string? | null | Custom CSS classes/styles for the description of the BitProgress. |
BitColor enum
| Name | Value | Description |
|---|---|---|
| Primary | 0 | Primary general color. |
| Secondary | 1 | Secondary general color. |
| Tertiary | 2 | Tertiary general color. |
| Info | 3 | Info general color. |
| Success | 4 | Success general color. |
| Warning | 5 | Warning general color. |
| SevereWarning | 6 | SevereWarning general color. |
| Error | 7 | Error general color. |
| PrimaryBackground | 8 | Primary background color. |
| SecondaryBackground | 9 | Secondary background color. |
| TertiaryBackground | 10 | Tertiary background color. |
| PrimaryForeground | 11 | Primary foreground color. |
| SecondaryForeground | 12 | Secondary foreground color. |
| TertiaryForeground | 13 | Tertiary foreground color. |
| PrimaryBorder | 14 | Primary border color. |
| SecondaryBorder | 15 | Secondary border color. |
| TertiaryBorder | 16 | Tertiary border color. |
BitPlacement enum
| Name | Value | Description |
|---|---|---|
| Top | 0 | The top edge. |
| Bottom | 1 | The bottom edge. |
| Start | 2 | The edge the reading direction starts from - the left in LTR, the right in RTL. On the vertical axis, which does not turn around, it is the top. |
| End | 3 | The edge the reading direction ends at - the right in LTR, the left in RTL. On the vertical axis, which does not turn around, it is the bottom. |
| Left | 4 | The left edge, in both reading directions. |
| Right | 5 | The right edge, in both reading directions. |
| Center | 6 | The middle of the axis, against neither edge. |
| TopAndBottom | 7 | Both edges of the block axis at once. |
| StartAndEnd | 8 | Both edges of the inline axis at once, following the reading direction the way Start and End do. |
BitProgressPercentPosition enum
| Name | Value | Description |
|---|---|---|
| End | 0 | Under the bar, aligned to the end of it. This is the default. |
| Start | 1 | Under the bar, aligned to the start of it. |
| Center | 2 | Under the bar, in the middle of it. |
| Inside | 3 | On the bar itself rather than under it, which keeps the whole indicator to one line. |
| Top | 4 | Above the bar, on the same row as the label and aligned to the end of it. Without a label it is a line of its own above the bar. |
BitShape enum
| Name | Value | Description |
|---|---|---|
| Rounded | 0 | The corner radius the current theme gives to this kind of surface, which is what most components draw unless something says otherwise. |
| Square | 1 | Sharp corners with no radius at all, for content that meets its container edge to edge. |
| Pill | 2 | Fully rounded ends, whatever the theme says: a pill where the box is wider than it is tall, and a circle where the box is square. |
BitSize enum
| Name | Value | Description |
|---|---|---|
| Small | 0 | The small size. |
| Medium | 1 | The medium size. |
| Large | 2 | The large size. |
BitVisibility enum
| Name | Value | Description |
|---|---|---|
| Visible | 0 | The content of the component is visible. |
| Hidden | 1 | The content of the component is hidden, but the space it takes on the page remains (visibility:hidden). |
| Collapsed | 2 | The component is hidden (display:none). |
BitDir enum
| Name | Value | Description |
|---|---|---|
| Ltr | 0 | Ltr (left to right) is to be used for languages that are written from the left to the right (like English). |
| Rtl | 1 | Rtl (right to left) is to be used for languages that are written from the right to the left (like Arabic). |
| Auto | 2 | Auto lets the user agent decide. It uses a basic algorithm as it parses the characters inside the element until it finds a character with a strong directionality, then applies that directionality to the whole element. |
Feedback
Found a mistake, a gap, or something that could be clearer? Every page and every component is one click from its source.