Skip to content

Progress

Loading

Bit.BlazorUI

A family of eighteen loading animations - spinners, dots, bars and shapes - that all share the same API. Each one is pure CSS: a theme color or a custom one, three sizes or a size in pixels, a stroke thickness for the ones drawn with a line, an optional label on any of the four sides, a speed multiplier, a pause, a delay that keeps a loader from flashing up for work that turns out to be quick, and a live region so the wait is announced rather than only drawn.

Notes

A loading component reports that work is under way without saying how much of it is left, which is what suits a wait of roughly one to ten seconds. Below about three hundred milliseconds show nothing at all - hold the loader back with Delay rather than letting it flash up and vanish. When the surface being filled has a shape that is already known, a BitShimmer placeholder reads better than a spinner; and once the work can report its own progress - or runs well past ten seconds - a determinate BitProgress is the honest choice.

Usage

Every example is live. Open its code to see exactly what produced the component running underneath.

Basic

Every loader is its own component and they all take the same parameters, so picking one is purely a question of which animation suits the surface. Nothing here needs to be configured: a bare tag renders a 64px drawing in the theme's primary color that loops until it is removed from the page. What separates them is weight - a ring or a spinner is quiet enough to sit inside a control, while the heart, the hourglass or the rolling square are large gestures better suited to an empty page.


BitBarsLoading
Loading
BitCircleLoading
Loading
BitDotsRingLoading
Loading
BitDualRingLoading
Loading
BitEllipsisLoading
Loading
BitGridLoading
Loading
BitHeartLoading
Loading
BitHourglassLoading
Loading
BitRingLoading
Loading
BitRippleLoading
Loading
BitRollerLoading
Loading
BitSpinnerLoading
Loading
BitXboxLoading
Loading
BitSlickBarsLoading
Loading
BitBouncingDotsLoading
Loading
BitRollingDashesLoading
Loading
BitOrbitingDotsLoading
Loading
BitRollingSquareLoading
Loading

Label

Label is what turns a spinning shape into a status message, and it is also what a screen reader announces in place of the default text described under Accessibility. Prefer something specific and present-tense - "Uploading photos..." says far more than "Loading" - and keep it to a few words: the label scales with the Size of the loader, so a sentence quickly grows wider than the drawing it sits under.


LabelPosition

LabelPosition puts the label on any of the four sides of the drawing. Top is the default. Start and End follow the direction of the writing and swap sides in a right-to-left layout, while Top and Bottom stay where they are.


LabelTemplate

LabelTemplate replaces the label with markup of your own - a second line, a link, an elapsed-time counter - and it takes the place of Label when both are given. It sits in the same slot, so LabelPosition still decides which side of the drawing it lands on, and it counts as a visible label, so the loader stops rendering its hidden fallback text and announces the template instead.


Loading
Restoring your session

Speed

Speed is a multiplier over the animation's normal pace: 2 runs it twice as fast, 0.5 half as fast. Every duration and every delay inside the loader is scaled together, so the phase offsets that stagger its parts against each other survive rather than bunching up. The multiplier composes with the reduced-motion preference instead of overriding it - a loader in a reduced-motion environment still runs at the calmer pace the theme picks, only scaled by this value - which is why a fast loader is safe to reach for. Zero and negative values are ignored.


Paused

Paused holds the animation at the frame it had reached instead of removing it. The drawing keeps its shape and its place in the layout, so pausing and resuming never makes the surface around it jump, and the live region stays exactly as it was - it is the movement alone that stops. A paused loader still says that work is under way, so reach for it only where that remains true and the movement is what has to stop: a wait that has stalled behind a retry, or a page whose animations are held while it is captured. Once the work is over, remove the component rather than pausing it.




Delay

Work that finishes inside a few hundred milliseconds reads as instant, and a loader that flashes up and vanishes again inside that window is more distracting than no loader at all. Delay holds the component back for that many milliseconds before it shows anything: if the work finishes first, the loader is removed before the delay elapses and nothing was ever shown; if it does not, the loader appears as usual. Changing the number opens the window again from the new length, and setting it back to zero lets the loader through at once, so one kept in the document across several waits can be held back for each of them without being re-created.




No delay
Delay="500"
Delay="3000" (never shows)

Thickness

Thickness sets the width, in pixels, of the stroke the drawing is made of. Only the loaders drawn with a stroke read it - BitRingLoading, BitDualRingLoading, BitRippleLoading, BitXboxLoading and BitSpinnerLoading - and the rest, whose shapes are filled rather than stroked, are left as they are. Each of them draws the stroke inside its own outline, so a thicker one never grows the footprint of the component past the size it was given.

It is a literal number of pixels rather than a ratio, so it does not scale with Size: a hairline stays a hairline whatever the loader is sized at, which is what lets a 16px inline loader and an 88px one on an empty page read as the same weight of line. Zero and negative values are ignored, and leaving it unset keeps the thickness each drawing was authored with.



Inline

A loader is a block of its own by default, sized in pixels and centred on its own line. Inline lays it out as an inline box aligned to the middle of the current line instead, so it can sit inside a sentence, a button, a table cell or a heading without pushing anything onto a new line. Pair it with a small CustomSize and with CustomColor="currentColor", which takes the color of the text around it.


Fetching the latest results
Loading
please wait.

Accessibility

A spinning shape says nothing on its own, so the root element is a live region: it carries role="status" and aria-live="polite", and its text is announced when the loader appears. That text is the Label when there is one; without a label the component renders a visually hidden "Loading" instead, which AriaLabel replaces with wording of your own. The drawing itself is marked aria-hidden, so none of its geometry is walked by a screen reader.

Role and AriaLive change that contract where the surroundings call for it. Role="progressbar" suits a wait that is measured and reported through the aria-value attributes - but everything inside a progressbar is presentational, so a visible label is no longer announced from within it. Role="none" silences a purely decorative loader whose surroundings already report the wait, which is the right choice when several loaders appear at once. AriaLive="assertive" interrupts the screen reader rather than waiting for it, and is only appropriate where the wait itself is what the user has to hear about right now.


Default
Loading
AriaLabel
Fetching your orders
Role="none"
AriaLive="assertive"

Color

Color paints the whole drawing in one of the theme's roles, so a loader re-skins with the rest of the library when the theme or the color scheme changes. CustomColor takes any valid CSS color instead - a keyword, a hex value, rgb(), hsl(), and currentColor to inherit the color of the surrounding text - and only applies while Color is left unset, since a theme role always wins over a literal color.


Theme colors:



Custom colors:

Size

Size offers the three sizes shared across the library - Small (40px), Medium (64px, the default) and Large (88px) - and CustomSize takes any number of pixels for the cases those three do not cover, such as the 16px loader that fits inside a line of text. Everything scales together: the drawing, the strokes it is built from and the label under it. CustomSize only applies while Size is left unset.


Style & Class

Style and Class land on the root of the component - the box that holds the drawing and the label - while Styles and Classes reach every part of it on its own: the root, the container of the animation, each of its child elements, the label, and the visually hidden text a labelless loader announces. The loader also reads a handful of CSS variables off its root, for what no parameter covers: --bit-ldn-color for the color of the drawing, --bit-ldn-size for its size in pixels, --bit-ldn-font-size for the label, --bit-ldn-stroke for the width of the stroke, which is what Thickness writes over, and --bit-ldn-mot-factor for the factor every duration and delay inside it is multiplied by, which is what Speed writes over.


Component's Style & Class:



CSS variables:



Styles & Classes:

RTL

Use BitLoading in right-to-left (RTL). Most of the animations turn about their own centre and look the same either way, so what the direction usually changes is the label: Start and End follow the direction of the writing and move to the other side of the drawing with it, while Top and Bottom stay where they are.

The two loaders whose motion actually travels across the box - the ellipsis, whose dots march along, and the rolling square - are mirrored instead, so that they run toward the end of the line the way an indeterminate progress bar does rather than always to the right.


API

Every parameter, public member, sub-class and enum this component exposes.

BitLoading parameters

Name Type Default value Description
AriaLive string? null How insistently the live region of the loading component announces itself, rendered as the aria-live attribute of the root element. Falls back to "polite".
Classes BitLoadingClassStyles? null Custom CSS classes for different parts of the loading component.
Color BitColor? null The general color of the loading component.
CustomColor string? null The custom css color of the loading component. Only applies while Color is left unset.
CustomSize int? null The custom size of the loading component in px. Only applies while Size is left unset.
Delay int 0 How long, in milliseconds, the loading component waits before it shows anything, so that a quick task never makes it flash up and vanish again. Changing the value opens the window again from the new length.
Inline bool false Lays the loading component out as an inline box aligned to the middle of the current line, so it can sit inside a sentence, a button or a table cell.
Label string? null The text content of the label of the loading component, which is also what assistive technology announces.
LabelPosition BitLabelPosition? null The position of the label of the loading component.
LabelTemplate RenderFragment? null The custom content of the label of the loading component.
Paused bool false Holds the animation of the loading component at the frame it had reached instead of running it. The drawing keeps its shape and its place in the layout, so only the movement stops.
Role string? null The ARIA role of the root element of the loading component. Falls back to "status", which makes the root a live region.
Size BitSize? null The Size of the loading component.
Speed double? null How fast the animation runs, as a multiplier of its normal speed: 2 is twice as fast, 0.5 half as fast. Zero and negative values are ignored.
Styles BitLoadingClassStyles? null Custom CSS styles for different parts of the loading component.
Thickness int? null The thickness, in px, of the stroke the loading component is drawn with. Only the loaders drawn with a stroke read it - BitRingLoading, BitDualRingLoading, BitRippleLoading, BitXboxLoading and BitSpinnerLoading - and it does not scale with Size. Zero and negative values are ignored.

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.

BitLoadingClassStyles properties

Name Type Default value Description
Root string? null Custom CSS classes/styles for the root element of the BitLoading components.
Container string? null Custom CSS classes/styles for the child container of the BitLoading components.
Child string? null Custom CSS classes/styles for the child element(s) of the BitLoading components.
Label string? null Custom CSS classes/styles for the label of the BitLoading components.
ScreenReaderText string? null Custom CSS classes/styles for the visually hidden text a labelless BitLoading component announces to assistive technology.

BitColor enum

Name Value Description
Primary 0 Info 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.

BitLabelPosition enum

Name Value Description
Top 0 The label shows above the animation.
End 1 The label shows at the end side of the animation, which follows the direction of the writing.
Bottom 2 The label shows below the animation.
Start 3 The label shows at the start side of the animation, which follows the direction of the writing.

BitSize enum

Name Value Description
Small 0 The small size, which renders a 40px loading component.
Medium 1 The medium size, which renders a 64px loading component.
Large 2 The large size, which renders an 88px loading component.

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.