|
| 1 | +@page "/mudloading" |
| 2 | + |
| 3 | +@inject ISnackbar Snackbar |
| 4 | + |
| 5 | +<ExamplePage Title="MudLoading"> |
| 6 | + <ExampleCard Title="Usage" Description="MudLoading is very useful to create loading conditions faster."> |
| 7 | + <MudGrid> |
| 8 | + <MudItem xs="12" sm="8" Class="d-flex gap-4 align-center flex-wrap"> |
| 9 | + <MudPaper Class="mud-width-full" Style="height: 300px; position: relative"> |
| 10 | + <MudLoading @bind-Loading="_loading" Overlap="@_overlap" LoaderType="_loaderType" Darken="_darken"> |
| 11 | + <MudStack> |
| 12 | + <MudText>This is a text inside a paper. Its the content.</MudText> |
| 13 | + <MudButton OnClick="ShowSnackbar" Variant="Variant.Filled" Color="Color.Primary">A Button Can Not Be Clickable While Loading</MudButton> |
| 14 | + </MudStack> |
| 15 | + </MudLoading> |
| 16 | + </MudPaper> |
| 17 | + </MudItem> |
| 18 | + |
| 19 | + <MudItem xs="12" sm="4"> |
| 20 | + <MudStack> |
| 21 | + <MudSwitch @bind-Checked="_loading" Color="Color.Primary">Loading</MudSwitch> |
| 22 | + <MudCheckBox @bind-Checked="_overlap" Label="Overlap" Color="Color.Primary" /> |
| 23 | + <MudCheckBox @bind-Checked="_darken" Label="Darken" Color="Color.Primary" /> |
| 24 | + <MudSelect @bind-Value="_loaderType" Variant="Variant.Outlined" Label="Loader Type"> |
| 25 | + <MudSelectItem Value="LoaderType.Circular">Circular</MudSelectItem> |
| 26 | + <MudSelectItem Value="LoaderType.Linear">Linear</MudSelectItem> |
| 27 | + </MudSelect> |
| 28 | + </MudStack> |
| 29 | + </MudItem> |
| 30 | + </MudGrid> |
| 31 | + </ExampleCard> |
| 32 | + |
| 33 | + <ExampleCard Title="Custom Loading Indicator" Description="Loading indicator can be a RenderFragment."> |
| 34 | + <MudGrid> |
| 35 | + <MudItem xs="12" sm="8" Class="d-flex gap-4 align-center flex-wrap"> |
| 36 | + <MudPaper Class="mud-width-full" Style="height: 300px; position: relative"> |
| 37 | + <MudLoading @bind-Loading="_loading2"> |
| 38 | + <LoaderContent> |
| 39 | + <div class="mud-width-full mud-height-full d-flex flex-column align-center justify-center"> |
| 40 | + <MudProgressLinear Color="Color.Primary" Indeterminate="true" /> |
| 41 | + <MudStack Row="true" Spacing="2"> |
| 42 | + <MudIcon Icon="@Icons.Custom.Brands.MudBlazor" Color="Color.Tertiary" Size="Size.Small" /> |
| 43 | + <MudIcon Icon="@Icons.Custom.Brands.MudBlazor" Color="Color.Secondary" Size="Size.Medium" /> |
| 44 | + <MudIcon Icon="@Icons.Custom.Brands.MudBlazor" Color="Color.Primary" Size="Size.Large" /> |
| 45 | + <MudIcon Icon="@Icons.Custom.Brands.MudBlazor" Color="Color.Secondary" Size="Size.Medium" /> |
| 46 | + <MudIcon Icon="@Icons.Custom.Brands.MudBlazor" Color="Color.Tertiary" Size="Size.Small" /> |
| 47 | + </MudStack> |
| 48 | + |
| 49 | + </div> |
| 50 | + </LoaderContent> |
| 51 | + <ChildContent> |
| 52 | + <MudText>This is a text inside a paper.</MudText> |
| 53 | + </ChildContent> |
| 54 | + |
| 55 | + </MudLoading> |
| 56 | + </MudPaper> |
| 57 | + </MudItem> |
| 58 | + |
| 59 | + <MudItem xs="12" sm="4"> |
| 60 | + <MudStack> |
| 61 | + <MudSwitch @bind-Checked="_loading2" Color="Color.Primary">Loading</MudSwitch> |
| 62 | + </MudStack> |
| 63 | + </MudItem> |
| 64 | + </MudGrid> |
| 65 | + </ExampleCard> |
| 66 | +</ExamplePage> |
| 67 | + |
| 68 | +@code{ |
| 69 | + bool _loading = true; |
| 70 | + bool _overlap; |
| 71 | + bool _darken; |
| 72 | + LoaderType _loaderType = LoaderType.Circular; |
| 73 | + |
| 74 | + bool _loading2 = true; |
| 75 | + |
| 76 | + |
| 77 | + private void ShowSnackbar() |
| 78 | + { |
| 79 | + Snackbar.Add("Button clicked.", Severity.Info); |
| 80 | + } |
| 81 | +} |
0 commit comments