MudBlazor extension components for Static Server-Side Rendered pages. Focuses on input components for forms.
$ dotnet add package Extensions.MudBlazor.StaticInput
MudBlazor.StaticInput is an extension package for the MudBlazor library.
Tailored specifically for Static Server-Side Rendered (static SSR) pages. It offers seamless integration for some of MudBlazor's Component design into your static application pages. Focusing particularly on components designed for forms and edit forms, in situations where interactive components are not feasible. For example, when scaffolding Blazor Identity UI in your application.
[!TIP] Default email:
demo@static.com
Default pword:MudStatic123!
The set of components and features may extend over time. Currently, StaticInput components include:
<MudStaticButton Variant="Variant.Filled" Color="Color.Primary">Login</MudStaticButton>
Note:
<MudButton>is 100% functional in forms when used correctly. The static component simply assists in assuring the correct usage.
<MudStaticCheckBox @bind-Value="@RememberMe" Color="Color.Success">Remember Me</MudStaticCheckBox>
@code{
public bool RememberMe { get; set; }
}
<MudStaticSwitch @bind-Value="@RememberMe" Color="Color.Success" UnCheckedColor="Color.Primary">Remember Me</MudStaticSwitch>
@code{
public bool RememberMe { get; set; }
}
<MudStaticTextField @bind-Value="@Password"
InputType="InputType.Password"
Adornment="Adornment.End"
AdornmentIcon="@Icons.Material.Outlined.Visibility"
AdornmentToggledIcon="@Icons.Material.Outlined.VisibilityOff"
AdornmentClickFunction="showPassword" />
@code {
public string Password { get; set; }
}
<script>
const passwordTimeouts = new WeakMap();
function showPassword(inputElement) {
if (!inputElement) return;
const existingTimeout = passwordTimeouts.get(inputElement);
if (existingTimeout) clearTimeout(existingTimeout);
if (inputElement.type === 'password') {
inputElement.type = 'text';
const timeoutId = setTimeout(function () {
inputElement.type = 'password';
passwordTimeouts.delete(inputElement);
}, 5000);
passwordTimeouts.set(inputElement, timeoutId);
} else {
inputElement.type = 'password';
passwordTimeouts.delete(inputElement);
}
}
</script>
<MudStaticRadioGroup @bind-Value="@SelectedOption" Color="Color.Primary">
<MudStaticRadio Value="@("Option 1")" Color="Color.Secondary">Option 1</MudStaticRadio>
<MudStaticRadio Value="@("Option 2")">Option 2</MudStaticRadio>
</MudStaticRadioGroup>
@code {
public string SelectedOption { get; set; } = "Option 1";
}
<MudStaticNavDrawerToggle id="static-left-toggle" DrawerId="static-mini" Icon="@Icons.Material.Filled.Menu" Color="Color.Inherit" Edge="Edge.Start" />
<MudDrawer id="static-mini" Fixed="false" Elevation="1" Anchor="Anchor.Start" Variant="@DrawerVariant.Mini" ClipMode="DrawerClipMode.Always">
<MudNavMenu>
<MudNavLink Match="NavLinkMatch.All" Icon="@Icons.Material.Filled.Store">Store</MudNavLink>
<MudNavLink Match="NavLinkMatch.All" Icon="@Icons.Material.Filled.LibraryBooks">Library</MudNavLink>
<MudNavLink Match="NavLinkMatch.All" Icon="@Icons.Material.Filled.Group">Community</MudNavLink>
</MudNavMenu>
</MudDrawer>
<MudNavMenu>
<MudNavLink Href="/dashboard">Dashboard</MudNavLink>
<MudNavLink Href="/servers">Servers</MudNavLink>
<MudNavLink Href="/billing" Disabled="true">Billing</MudNavLink>
<MudStaticNavGroup Title="Settings" Expanded="true">
<MudNavLink Href="/users">Users</MudNavLink>
<MudNavLink Href="/security">Security</MudNavLink>
</MudStaticNavGroup>
<MudNavLink Href="/about">About</MudNavLink>
</MudNavMenu>
To start using MudBlazor.StaticInput in your projects, simply install the package via NuGet Package Manager:
dotnet add package Extensions.MudBlazor.StaticInput
[!NOTE]
MudBlazor should already be setup for your application.
Ensure MudBlazor services are registered in your Program.cs:
builder.Services.AddMudServices();
The library utilizes a Blazor JS initializer to automatically load the necessary client-side logic. No manual script tags are required for the core functionality in Blazor Web Apps.
You can now start using the components in your Static SSR pages. For example, in an Identity login page:
<MudStaticTextField @bind-Value="@Input.Email" Label="Email" For="() => Input.Email" />