Extras
TextShimmer
BitTextShimmer sweeps a bright gradient band across a run of text - the signal an AI thinking label, a loading message or a progressive reveal needs. The band is scaled to the text and follows its reading direction, and it can be retimed, delayed, rested between sweeps, played a set number of times, tilted, reversed, paused, colored from the theme and stopped once the work is over. It is pure CSS with no JavaScript interop, so it works in every render mode including static SSR; the text stays real text for copying, find-in-page and screen readers, and falls back to a flat color wherever the shimmer cannot or should not be painted.
Notes
To use this component, you need to install the Bit.BlazorUI.Extras(opens in a new tab) nuget package, as described in the Optional steps of the Getting started page.
By default, BitTextShimmer honors the reduced motion preference of the OS/browser (prefers-reduced-motion) and shows a static, dim text instead of animating. If you don't see the shimmer sweep, either disable the reduce motion setting, use the ForceAnimation parameter, or turn on the ForceAnimation toggle that appears at the top of this page while reduced motion is on.
Usage
Every example is live. Open its code to see exactly what produced the component running underneath.
Basic
The shimmer is a paint effect only: the characters are real text, so they are copied, found by a find-in-page and read out by a screen reader exactly as they are written.
The shimmer honors the reduced motion preference of the OS/browser and shows the text in its resting color instead of animating. ForceAnimation keeps it animating regardless - reserve it for a shimmer whose motion carries a meaning that is lost without it.
Thinking about your question...
This shimmer keeps animating even in reduced motion mode
Element
A value that is not a name a tag can have falls back to the default tag. A void element (such as br or img) is a valid name and is kept, but it is defined to hold no content, so neither Text nor ChildContent is rendered into it: a shimmer that shows text needs a non-void element.
A shimmering heading
Spread
SpreadLength replaces that computation with an explicit CSS length. A font-relative one (em, ch) follows the size of the text without counting its characters, so the same shimmer looks alike in a heading and in a caption.
A wide shimmer band
A narrow shimmer band
A band two ems wide
A band two ems wide
Content
The length of the content cannot be measured, so supply ContentLength - the character count to scale the band by, 10 by default - or give the band a font-relative SpreadLength that needs no count at all.
An emoji is painted by the band too, as a silhouette of it. Give it a fill of its own (-webkit-text-fill-color: currentcolor) to keep its colors - which is also what a transformed part of the content, such as a spinning icon, needs to be painted at all.
Thinking really hard about it...
Searching the docs for an answer...
✨ Generating a summary...
Timing
RepeatDelay adds to that rest without changing the speed of the band, which is what keeps a label that stays on screen for a long while from reading as a blinking one.
Delay postpones the first sweep. Giving each shimmer of a list a slightly later start than the one before it turns many shimmers blinking at once into one wave running down the list.
Slow and calm shimmer (4 seconds)
Fast and urgent shimmer (750 milliseconds)
A sweep, then an extra two seconds of rest
Reading the question...
Searching the knowledge base...
Drafting an answer...
Direction
Following the reading direction (default)
Against the reading direction
Back and forth
Angle
A band tilted by 25 degrees
A band tilted by -25 degrees
Iterations
Revealed with a single sweep
Three sweeps, then at rest
Playback
Static takes the band away altogether and leaves the plain text in its resting color - the finished state of a label that stays on the page once the work is over; turning it off starts the sweeps again from the beginning. A disabled shimmer (IsEnabled="false") is at rest as well, and dimmed.
Pause me and resume me
Hover over me to pause the sweep
Stop me and start me again
A disabled shimmer
Thinking status
A calm RepeatDelay keeps a wait that runs long from turning into a distraction.
Ask a question to see the assistant think.
Color
BaseColor and GradientColor take any CSS color for the resting text and the band, and the explicit GradientColor wins over Color. The resting color is what the text is read in most of the time, so it is the one to check for contrast.
Primary
Secondary
Tertiary
Info
Success
Warning
SevereWarning
Error
An ocean colored shimmer
A golden colored shimmer
Style & Class
A styled text shimmer
A classy text shimmer
A band colored through a custom property
RTL
در حال فکر کردن به سوال شما...
در حال جستجو در مستندات...
نواری که ۲۵ درجه کج شده است
API
Every parameter, public member, sub-class and enum this component exposes.
BitTextShimmer parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| Alternate | bool | false | Sweeps the band back and forth across the text instead of always in the same direction. Reversed decides which of the two directions comes first. |
| Angle | double? | null | The tilt of the band in degrees, measured from upright. A positive angle leans the top of the band towards the end of the text in its reading direction, so a right-to-left shimmer is mirrored. Keep it within about 45 degrees either way; a value that is not a finite number is ignored. |
| BaseColor | string? | null | The resting/dim color of the text. When null, a theme-aware default color is used. It is the color the text is read in most of the time, so it is the one to check for contrast. |
| ChildContent | RenderFragment? | null | The content to shimmer, which takes precedence over the Text parameter. Its length cannot be measured, so the band is scaled by ContentLength (or sized by SpreadLength) instead. A part that should keep its own colors (an emoji), or that is transformed (a spinning icon), needs a fill of its own. |
| Color | BitColor? | null | The general color of the band that sweeps across the text, read from the theme. An explicit GradientColor wins over it. |
| ContentLength | int | 10 | The character count used to scale the shimmer band width when the content is supplied using ChildContent (or when neither ChildContent nor Text is set). |
| Delay | int? | null | The delay before the first shimmer sweep starts in ms. The text rests in its base color until then. A negative value is treated as zero. |
| Duration | int? | null | The animation duration of one full shimmer sweep in ms - the band crossing the text and the rest before it enters again. When null, a two-second sweep is used. A negative value is treated as zero. |
| Element | string? | null | The custom html element used for the root node. The default is "p"; a value that is not a name a tag can have falls back to it. A void element (such as "br" or "img") holds no content, so neither Text nor ChildContent is rendered into it. |
| GradientColor | string? | null | The bright highlight color that sweeps across the text. When null, a theme-aware default color is used. It wins over Color. |
| Iterations | int? | null | The number of shimmer sweeps to play before the text comes to rest. When null (or below one), the shimmer sweeps forever. |
| Paused | bool | false | Holds the shimmer where it is instead of sweeping. The band stops wherever it had reached and carries on from there once this is turned off again. |
| PauseOnHover | bool | false | Holds the shimmer where it is while the pointer is over it or the focus is inside it. |
| RepeatDelay | int? | null | An extra pause between two shimmer sweeps in ms, which adds to the rest between them without changing the speed of the band. Without a Duration it is retuned by the theme along with the sweep. A negative value is treated as zero. |
| Reversed | bool | false | Sweeps the band against the reading direction. The band follows the reading direction by default, whether it comes from the Dir parameter or from the page around the shimmer. |
| Spread | double | 2 | The shimmer band width multiplier. The effective spread of the band (px) - from its brightest point to each of its edges - is Spread times the character count, so longer text gets a proportionally wider shine. SpreadLength wins over it. |
| SpreadLength | string? | null | An explicit CSS length for the spread of the band, which replaces the one computed from Spread and the character count. A font-relative length (em, ch) follows the size of the text without counting its characters. |
| Static | bool | false | Renders the text at rest in its base color, without the shimmer. Unlike Paused, it takes the band away altogether; turning it off starts the sweeps from the beginning. |
| Text | string? | null | The text to display, that is also used to scale the shimmer band width based on its character count. |
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. |
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. |
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.