Spinner

in namespace DotVVM.Controls.Tailwind.Controls

Displays an animated loading spinner with an accessible sr-only label.

Usage & Scenarios

Displays an animated loading indicator. Use AriaLabelText to customize the screen-reader text.

Sample 1: Basic and localized spinner

Shows the default spinner and a second spinner with a custom AriaLabelText value.

<div class="space-y-4">
    <div class="flex items-center gap-3">
        <t:Spinner />
        <span>Loading data...</span>
    </div>

    <div class="flex items-center gap-3">
        <t:Spinner AriaLabelText="Synchronizing dashboard widgets..." />
        <span>Custom accessible label</span>
    </div>
</div>

Sample 2: Conditional visibility

Uses the standard Visible property to show and hide the spinner while a command toggles the loading state.

<div class="space-y-4">
    <div class="space-y-2">
        <t:Spinner Visible="{value: IsLoading}" />
        <p Visible="{value: IsLoading}" class="text-sm text-gray-500">Loading data...</p>
    </div>

    <t:Button Type="Primary" Text="Toggle loading" Click="{command: ToggleLoading()}" />
</div>
using DotVVM.Framework.ViewModel;

namespace DotvvmWeb.Views.Docs.Controls.tailwind.Spinner.sample2
{
    public class ViewModel : DotvvmViewModelBase
    {
        public bool IsLoading { get; set; }

        public void ToggleLoading()
        {
            IsLoading = !IsLoading;
        }
    }
}

Properties

Name Type Description Notes Default Value
property icon AriaLabelText String The text rendered inside the sr-only span for screen readers. Defaults to "Loading...".
attribute
inner element
static value
bindable
default
Loading...
property icon Visible Boolean Gets or sets whether the control is visible. When set to false, `style="display: none"` will be added to this control.
attribute
inner element
static value
bindable
default
True

HTML produced by the control