|
| 1 | +@attribute [Route(pageUrl)] |
| 2 | +@layout DemosMainLayout |
| 3 | + |
| 4 | +<PageMetaTags PageUrl="@pageUrl" Title="@metaTitle" Description="@metaDescription" ImageUrl="@imageUrl" /> |
| 5 | + |
| 6 | +<PageHero Title="@pageTitle"> |
| 7 | + <SubTitleTemplate> |
| 8 | + @((MarkupString)pageDescription) |
| 9 | + </SubTitleTemplate> |
| 10 | +</PageHero> |
| 11 | + |
| 12 | +<DocsLink Href="@DemoRouteConstants.Docs_Spinner_Documentation" /> |
| 13 | + |
| 14 | +<Section Class="p-0" Size="HeadingSize.H3" Name="How it works" PageUrl="@pageUrl" Link="how-it-works"> |
| 15 | + <Block> |
| 16 | + The <strong>Spinner</strong> component shows a compact loading indicator for asynchronous work such as fetching data, saving changes, or waiting for background tasks. |
| 17 | + <br /><br /> |
| 18 | + <strong>How to use:</strong> |
| 19 | + <div class="content mb-2"> |
| 20 | + <ol> |
| 21 | + <li>Add the <code>Spinner</code> component to your page.</li> |
| 22 | + <li>Optionally set the <code>Color</code> property to a Bulma semantic color that matches the surrounding UI.</li> |
| 23 | + <li>Keep the default <code>Label</code> or provide your own accessible loading text for screen readers.</li> |
| 24 | + </ol> |
| 25 | + </div> |
| 26 | + This demo shows the default spinner in a typical inline loading scenario. |
| 27 | + </Block> |
| 28 | + <Demo Type="typeof(Spinner_Demo_01_How_it_works)" Tabs="true" /> |
| 29 | +</Section> |
| 30 | + |
| 31 | +<Section Class="p-0" Size="HeadingSize.H3" Name="Types" PageUrl="@pageUrl" Link="types"> |
| 32 | + <Block> |
| 33 | + The <strong>Spinner</strong> component supports <code>SpinnerType.Border</code>, <code>SpinnerType.Grow</code>, and <code>SpinnerType.Dots</code>, letting you choose the visual style that best fits the page. |
| 34 | + <br /><br /> |
| 35 | + <strong>How to use:</strong> |
| 36 | + <div class="content mb-2"> |
| 37 | + <ol> |
| 38 | + <li>Use the default <code>SpinnerType.Border</code> for the standard spinner style.</li> |
| 39 | + <li>Set <code>Type="SpinnerType.Grow"</code> to switch to the grow variant.</li> |
| 40 | + <li>Set <code>Type="SpinnerType.Dots"</code> to render a dotted loading indicator.</li> |
| 41 | + </ol> |
| 42 | + </div> |
| 43 | + This demo compares the supported spinner types side by side. |
| 44 | + </Block> |
| 45 | + <Demo Type="typeof(Spinner_Demo_02_Types)" Tabs="true" /> |
| 46 | +</Section> |
| 47 | + |
| 48 | +<Section Class="p-0" Size="HeadingSize.H3" Name="Colors" PageUrl="@pageUrl" Link="colors"> |
| 49 | + <Block> |
| 50 | + The <strong>Spinner</strong> component supports Bulma semantic colors so the loading indicator can align with your status messaging or theme. |
| 51 | + <br /><br /> |
| 52 | + <strong>How to use:</strong> |
| 53 | + <div class="content mb-2"> |
| 54 | + <ol> |
| 55 | + <li>Set the <code>Color</code> property to a Bulma semantic value such as <code>Primary</code>, <code>Info</code>, <code>Success</code>, or <code>Danger</code>.</li> |
| 56 | + <li>Choose a color that stays visible against the spinner's background.</li> |
| 57 | + </ol> |
| 58 | + </div> |
| 59 | + This demo illustrates Bulma semantic color options for the border, grow, and dots spinner types. |
| 60 | + </Block> |
| 61 | + <Demo Type="typeof(Spinner_Demo_03_Colors)" Tabs="true" /> |
| 62 | +</Section> |
| 63 | + |
| 64 | +<Section Class="p-0" Size="HeadingSize.H3" Name="Size" PageUrl="@pageUrl" Link="size"> |
| 65 | + <Block> |
| 66 | + The <strong>Spinner</strong> component can be displayed in multiple Bulma size classes to suit inline text, cards, panels, or larger loading states. |
| 67 | + <br /><br /> |
| 68 | + <strong>How to use:</strong> |
| 69 | + <div class="content mb-2"> |
| 70 | + <ol> |
| 71 | + <li>Set the <code>Size</code> property to <code>SpinnerSize.Small</code>, <code>SpinnerSize.Normal</code>, <code>SpinnerSize.Medium</code>, or <code>SpinnerSize.Large</code> to follow the Bulma size scale.</li> |
| 72 | + <li>Leave <code>Size</code> unset to use the default spinner size.</li> |
| 73 | + </ol> |
| 74 | + </div> |
| 75 | + This demo shows the supported Bulma size options for the border, grow, and dots spinner types. |
| 76 | + </Block> |
| 77 | + <Demo Type="typeof(Spinner_Demo_04_Sizes)" Tabs="true" /> |
| 78 | +</Section> |
| 79 | + |
| 80 | +<Section Class="p-0" Size="HeadingSize.H3" Name="IsVisible" PageUrl="@pageUrl" Link="isvisible"> |
| 81 | + <Block> |
| 82 | + The <strong>IsVisible</strong> property lets you control whether the spinner is rendered, which is useful for toggling loading states from your page logic. |
| 83 | + <br /><br /> |
| 84 | + <strong>How to use:</strong> |
| 85 | + <div class="content mb-2"> |
| 86 | + <ol> |
| 87 | + <li>Bind the <code>IsVisible</code> property to a boolean field.</li> |
| 88 | + <li>Update that field when your loading operation starts or ends.</li> |
| 89 | + </ol> |
| 90 | + </div> |
| 91 | + This demo shows how to show, hide, and toggle a spinner through the <code>IsVisible</code> parameter. |
| 92 | + </Block> |
| 93 | + <Demo Type="typeof(Spinner_Demo_05_IsVisible)" Tabs="true" /> |
| 94 | +</Section> |
| 95 | + |
| 96 | +<Section Class="p-0" Size="HeadingSize.H3" Name="Methods" PageUrl="@pageUrl" Link="methods"> |
| 97 | + <Block> |
| 98 | + The <strong>Spinner</strong> component exposes <code>Show()</code> and <code>Hide()</code> methods for instance-based control when you are working with a component reference. |
| 99 | + <br /><br /> |
| 100 | + <strong>How to use:</strong> |
| 101 | + <div class="content mb-2"> |
| 102 | + <ol> |
| 103 | + <li>Capture the component with <code>@@ref</code>.</li> |
| 104 | + <li>Call <code>Show()</code> or <code>Hide()</code> on that reference when you want to update visibility imperatively.</li> |
| 105 | + </ol> |
| 106 | + </div> |
| 107 | + This demo shows direct control of a spinner instance through its public methods. |
| 108 | + </Block> |
| 109 | + <Demo Type="typeof(Spinner_Demo_06_Methods)" Tabs="true" /> |
| 110 | +</Section> |
| 111 | + |
| 112 | +@code { |
| 113 | + private const string componentName = nameof(Spinner); |
| 114 | + private const string pageUrl = DemoRouteConstants.Demos_Spinner_Documentation; |
| 115 | + private const string pageTitle = componentName; |
| 116 | + private const string pageDescription = $"Use the <code>{componentName}</code> component to indicate loading states with Bulma-aligned colors, Bulma size classes, and built-in visibility controls."; |
| 117 | + private const string metaTitle = $"Blazor {componentName} Component"; |
| 118 | + private const string metaDescription = $"Use the {componentName} component to indicate loading states with Bulma-aligned colors, Bulma size classes, and built-in visibility controls."; |
| 119 | + private const string imageUrl = ""; |
| 120 | +} |
0 commit comments