Skip to main content
twblazor
Home
  • Get started
  • Tailwind with Blazor
  • Why twblazor?
  • Theme
  • Class Merge
    • Configuring localization
    • RTL Provider
  • Breadcrumb
  • Card
  • Carousel
  • Collapse
  • Context Menu
  • Drawer
  • Footer
  • Menu
  • Navbar
  • On This Page
  • Separator
  • Sidebar
  • Stepper
  • Tabs
  • Tree List
  • Container
  • Flex
  • Grid
  • Text
  • Link
  • Button
  • Form
    • AutocompleteNew
    • Checkbox
    • Color Picker
    • Date Picker
    • Date Range Picker
    • Datetime Picker
    • Datetime Range Picker
    • File Upload
    • Input GroupNew
    • NumericNew
    • Masked InputNew
    • Radio Button
    • Range SliderNew
    • RatingNew
    • Select
    • Slider
    • Switch
    • Tag InputNew
    • Text EditorNew
    • Textfield
    • Time Picker
    • Time Range Picker
  • Toggle
  • Toggle Group
  • Alert
  • Avatar
  • Badge
  • Chip
  • Empty
  • Icon
  • Popover
  • Progress
  • Skeleton
  • Spinner
  • Tooltip
  • Data Table
  • SpreadsheetNew
  • Column Filter Editor
  • Pagination
  • Pick List
  • Barcode
  • QR Code
  • Calendar
  • Table
  • Attachment
  • Overview
    • Bar
    • Bullet
    • Column
    • Dot Plot
    • Dumbbell
    • Icon
    • Lollipop
    • Radial Bar
    • Range
    • Word Cloud
    • Area
    • Bump
    • Bump Area
    • Candlestick
    • Gantt
    • Horizon
    • Line
    • Slope
    • Small Multiples
    • Stream Graph
    • Funnel
    • Gauge
    • Marimekko
    • Nightingale
    • Pie
    • Treemap
    • Waffle
    • Waterfall
    • Circular Treemap
    • Convex Treemap
    • Dendrogram
    • Sunburst
    • Barcode
    • Beeswarm
    • Box Plot
    • Density Plot
    • Histogram
    • Radial Histogram
    • Ridgeline
    • Strip Plot
    • Violin Plot
    • Categorical Scatter
    • Contour
    • Hexagonal Binning
    • Quadrant
    • Scatter
    • Heatmap
    • Matrix
    • Parallel Coordinates
    • Radar
    • Arc Diagram
    • Chord Diagram
    • Flowchart
    • Network Diagram
    • Sankey
    • Euler Diagram
    • Venn Diagram
  • Bubble
  • Marker
  • Message
  • Dialog Service
  • Toast Service
API DocumentationAI Agents & Skills
Home Get Started

Feedback

TwSpinner

TwSpinner is a Blazor loading spinner component. Set Size, Color, Label and ShowLabel, or use it inside a button.

Last updated 6 October 2026

Basic usage

An animated loading indicator rendered as an <output> element, so status changes are announced to assistive technology. The Label ("Loading..." by default) is always in the DOM for assistive technology, even when not shown visually.
Loading...
RAZOR
<TwSpinner AriaLabel="Loading" />

Sizes

Use Size to control the spinner's dimensions.
Loading... Loading... Loading...
RAZOR
<div class="flex items-center gap-6">
    <TwSpinner Size="SpinnerSize.Small" AriaLabel="Loading, small" />
    <TwSpinner Size="SpinnerSize.Medium" AriaLabel="Loading, medium" />
    <TwSpinner Size="SpinnerSize.Large" AriaLabel="Loading, large" />
</div>

Colors

Use Color to match the spinner to its surrounding context.
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
RAZOR
@foreach (Color c in ((Color[])Enum.GetValues(typeof(Color))).Take(10))
{
    @if (c != Color.Light && c != Color.Dark)
    {
        <div class="p-3 inline-flex">
            <TwSpinner AriaLabel="@c.ToString()" Color="@c" />
        </div>
    }
    else
    {
        <div class="@(c == Color.Light ? "bg-gray-900 p-3 rounded-lg inline-flex" : "bg-white p-3 rounded-lg inline-flex")">
            <TwSpinner AriaLabel="@c.ToString()" Color="@c" />
        </div>
    }
}

Visible label

By default the label text is only announced to assistive technology. Set ShowLabel to display it next to the spinner too.
Loading... Uploading files...
RAZOR
<div class="flex flex-col gap-4">
    <TwSpinner Label="Loading..." ShowLabel Color="Color.Primary" />
    <TwSpinner Label="Uploading files..." ShowLabel Size="SpinnerSize.Small" Color="Color.Success" />
</div>

Inside a button

A common pattern: swap a button's label for a small spinner while an async action is in flight.
RAZOR
<TwButton Color="Color.Primary" Variant="ButtonVariant.Outlined" Disabled="@isSaving" OnClick="Save">
    @if (isSaving)
    {
        <TwSpinner Size="SpinnerSize.Small" AriaLabel="Saving" />
    }
    else
    {
        @: Save changes
    }
</TwButton>
CSHARP
@code {
    private bool isSaving;
    
    private async Task Save()
    {
        isSaving = true;
        await Task.Delay(1500);
        isSaving = false;
    }
}

Keyboard navigation

A spinner is not interactive and is not a Tab stop. Screen readers announce its label when it appears.

Theme configuration

Styling is controlled by TwBlazorTheme.Components (a TwSpinnerTheme), configured via the AddTwBlazor() options callback described on the Get Started page. Every property is a set of Tailwind classes, so changes are picked up by your own Tailwind build.
Property Type Controls
Wrapper string
Base string
Track string
LightTrack string
DarkTrack string
Small string
Medium string
Large string
Label string

Global Theme Configuration

These reuse shared design tokens configured once on TwBlazorTheme, rather than being unique to this component.
Property Type Controls
Colors TwBlazorPalette

Full reference: TwSpinnerTheme on the API docs.

On this page

  • Basic usage
  • Sizes
  • Colors
  • Visible label
  • Inside a button
  • Keyboard navigation
  • Theme configuration
twblazor

The Tailwind CSS component library for Blazor. Accessible, themeable and MIT licensed.

Discord (opens in a new tab) GitHub(opens in a new tab)

Get started

  • Install guide
  • Theming
  • Class merging
  • Localization

Guides

  • Tailwind CSS with Blazor
  • Why twblazor?
  • Right to left
  • AI agents and skills

Resources

  • API documentation (opens in a new tab)
  • llms.txt (opens in a new tab)
  • MIT License (opens in a new tab)

Community

  • Contributing (opens in a new tab)
  • Code of conduct (opens in a new tab)
  • Report an issue (opens in a new tab)

twblazor is and always will be free and open source.

An unhandled error has occurred. Reload