menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class SpinnerTemplates - Blazor API Reference | Syncfusion

    Show / Hide Table of Contents

    Class SpinnerTemplates

    Specifies the template options for the Syncfusion.Blazor.Spinner.SfSpinner component. This allows you to define custom content to be displayed within the spinner.

    Inheritance
    System.Object
    SpinnerTemplates
    Namespace: Syncfusion.Blazor.Spinner
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class SpinnerTemplates : OwningComponentBase
    Remarks

    The SpinnerTemplates component is used as a child tag within the Syncfusion.Blazor.Spinner.SfSpinner component to specify a custom layout or content.

    Examples

    In the following example, a custom template is defined for the Syncfusion.Blazor.Spinner.SfSpinner.

    <SfSpinner @bind-Visible="@SpinnerVisible">
      <SpinnerTemplates>
          <Template>
              <div class="custom-spinner-template">
                  <div class="spinner-dot"></div>
                  <span>Loading...</span>
              </div>
          </Template>
      </SpinnerTemplates>
    </SfSpinner>
    
    <style>
    .custom-spinner-template {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-direction: column;
    }
    .spinner-dot {
       width: 20px;
       height: 20px;
       border-radius: 50%;
       background-color: #007bff;
       animation: bounce 1.4s infinite ease-in-out both;
    }
    @keyframes bounce {
      0%, 80%, 100% { transform: scale(0); }
      40% { transform: scale(1.0); }
    }
    </style>
    
    @code {
        private bool SpinnerVisible { get; set; } = true;
    }

    Constructors

    SpinnerTemplates()

    Declaration
    public SpinnerTemplates()

    Properties

    Template

    Gets or sets the custom content to be displayed within the spinner.

    Declaration
    public RenderFragment Template { get; set; }
    Property Value
    Type Description
    Microsoft.AspNetCore.Components.RenderFragment

    A Microsoft.AspNetCore.Components.RenderFragment that defines the template for the spinner. The default value is null.

    Remarks

    When this property is set, the default spinner animation is replaced with the custom content provided in the template.

    Methods

    Dispose()

    Releases the unmanaged resources used by the SpinnerTemplates component.

    Declaration
    public void Dispose()
    Remarks

    This method is called to dispose of the component and its resources.

    Dispose(Boolean)

    Releases the unmanaged resources used by the SpinnerTemplates component and optionally releases the managed resources.

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing

    A System.Boolean value that indicates whether the method call comes from a System.IDisposable.Dispose method (if true) or from a finalizer (if false).

    Remarks

    If disposing is true, this method releases all managed resources held by this component.

    OnInitialized()

    A protected method that is invoked when the component is initialized.

    Declaration
    protected override void OnInitialized()
    Remarks

    This method checks if a Template has been provided and, if so, updates the parent Syncfusion.Blazor.Spinner.SfSpinner component with the new template.

    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved