Loading
Loading spinners and animation indicators
The Loading component provides multiple animated indicators to communicate that content is being loaded or an operation is in progress. v0.4 rebuilds it with 23 variants, from the classic spinner to logo, snake, wave, typing and shimmer. The animations ship inside the component, so they also work with the NuGet package, and they follow the current text colour.
Installation
shellui add loading
Basic Usage
<Loading />
All variants
spinnerdotstypingwavepulseringdual-ringripplebarsbars-verticalbars-pulsegridsnakerowscolumnssequencetwinklelogoorbitactivitychaseprogressshimmer<div class="grid w-full grid-cols-2 gap-3 sm:grid-cols-4">
@foreach (var variant in variants)
{
<div class="flex h-24 flex-col items-center justify-between rounded-md border border-border p-3">
<div class="flex w-full flex-1 items-center justify-center">
<Loading Variant="@variant" />
</div>
<code class="text-xs text-muted-foreground">@variant</code>
</div>
}
</div>
@code {
private readonly string[] variants =
[
"spinner", "dots", "typing", "wave", "pulse", "ring", "dual-ring", "ripple",
"bars", "bars-vertical", "bars-pulse", "grid", "snake", "rows", "columns", "sequence",
"twinkle", "logo", "orbit", "activity", "chase", "progress", "shimmer",
];
}Variants
Spinner (Default)
A classic rotating spinner:
<Loading Variant="spinner" />
Dots
Three pulsing dots:
<Loading Variant="dots" />
Pulse
A pulsing circle:
<Loading Variant="pulse" />
Ring
An animated ring:
<Loading Variant="ring" />
Bars
Animated vertical bars:
<Loading Variant="bars" />
Grid
A pulsing grid pattern:
<Loading Variant="grid" />
Orbit
An orbiting animation:
<Loading Variant="orbit" />
Logo
The ShellUI mark, drawn dot by dot. shellui init uses the same animation in the terminal.
<div class="flex items-center gap-8">
<Loading Variant="logo" Size="sm" />
<Loading Variant="logo" />
<Loading Variant="logo" Size="lg" />
</div>Shimmer and typing
shimmer sweeps a highlight across its Text ("Loading..." by default), and typing is the three-dot indicator used in chat UIs. Label sets the name screen readers announce.
<div class="flex flex-col items-start gap-3">
<Loading Variant="shimmer" />
<Loading Variant="shimmer" Text="Generating a reply..." />
<Loading Variant="typing" Label="Assistant is typing" />
</div>Sizes
Control the loading indicator size:
<Loading Variant="spinner" Size="sm" />
<Loading Variant="spinner" Size="md" />
<Loading Variant="spinner" Size="lg" />
Full Page Loading
Overlay a loading indicator over the full viewport:
@if (isLoading)
{
<div class="fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm">
<Loading Variant="spinner" Size="lg" />
</div>
}
Inline Loading
Use loading indicators inline with content:
<Button Disabled="@isSaving">
@if (isSaving)
{
<Loading Variant="spinner" Size="sm" Class="mr-2" />
<span>Saving...</span>
}
else
{
<span>Save</span>
}
</Button>
@code {
private bool isSaving = false;
}
Skeleton vs Loading
Use Skeleton for content placeholders and Loading for active operations:
@* Content placeholder *@
<Skeleton Class="h-4 w-[200px]" />
@* Active operation *@
<Loading Variant="spinner" Size="sm" />
API Reference
| Property | Type | Default | Description |
|---|---|---|---|
Variant |
string |
"spinner" |
Animation style: spinner, dots, typing, wave, pulse, ring, dual-ring, ripple, bars, bars-vertical, bars-pulse, grid, snake, rows, columns, sequence, twinkle, logo, orbit, activity, chase, progress, shimmer |
Size |
string |
"default" |
Indicator size: sm, default, lg |
Label |
string |
"Loading" |
Accessible name announced by screen readers |
Text |
string? |
null |
Text for the shimmer variant |
Class |
string? |
null |
Additional CSS classes |
Accessibility
The Loading component includes:
role="status"for screen reader announcementsaria-label="Loading"by default; change it withLabel- Slows down under
prefers-reduced-motion - Hidden from screen readers when not visible