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
The progressbar role requires a name: give
every indicator a Label, or an AriaLabel where the text around it already says what is
loading.
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. A parameter that says the same thing 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 that one alone. 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 | The Color role's main color | Fill of the bar and stroke of the ring; the buffer and the stripes derive from it. BarColor wins over it. |
| --bit-Progress-bar-text-color | The Color role's text color | Color of a readout placed Inside the bar. |
| --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. |
| --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 | Per Size: --bit-siz-track-sm / -md / -lg (bar), 1x / 2x / 4x --bit-siz-spinner-stroke (ring) | Height of the bar, width of a vertical one and stroke of the ring. Thickness wins over it. |
| --bit-Progress-radius | --bit-shp-radius-none | Corner radius of the track and the bar. Rounded wins over it with a full radius. |
| --bit-Progress-diameter | Per Size: spacing(4) / spacing(6.25) / spacing(9) | Smallest diameter of the ring. Diameter wins 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. |
| --bit-Progress-font-size | Per Size: --bit-tpg-fs-xs / -sm / -md | Text size of the label and of the readout beside the bar. |
| --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 | Per Size: --bit-tpg-fs-2xs (small, medium), --bit-tpg-fs-xs (large) | Text size of the description. |
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. |
| 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. |
| 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. |
| GapPosition | BitProgressGapPosition | BitProgressGapPosition.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. |
| 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. |
| 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. |
| 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. |
| 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. |
| Id | string? | null | Gets or sets the unique identifier for the component's root element. |
| IsEnabled | bool | true | Gets or sets a value indicating whether the component is enabled and can respond to user interaction. |
| 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. |
BitProgressGapPosition enum
| Name | Value | Description |
|---|---|---|
| Bottom | 0 | At the bottom of the ring, which is where a gauge is normally opened. This is the default. |
| Top | 1 | At the top of the ring. |
| Start | 2 | At the starting side of the ring - the left in a left-to-right context, the right in a right-to-left one. |
| End | 3 | At the ending side of the ring - the right in a left-to-right context, the left in a right-to-left one. |
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. |
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.