Skip to content

Blazor Component Library extension for MudBlazor. Focusing on input components for Static Server-Side Rendered pages

License

Notifications You must be signed in to change notification settings

0phois/MudBlazor.StaticInput

Repository files navigation

MudBlazor.StaticInput

MudBlazor.StaticInput

GitHub License GitHub Actions Workflow Status NuGet Version NuGet Downloads

📖 Introduction 📖

MudBlazor.StaticInput is an extension package for the MudBlazor library.
Tailored specifically for Static Server-Side Rendered (static SSR) pages. It offers seamless integration of MudBlazor's Component design into your applications. Focusing particularly on components designed for forms and edit forms, in situations where interactive components are not feasible.
[example: Blazor Identity UI].

Static Input Demo

🤔 Why MudBlazor.StaticInput? 🤔

  • Rapid SSSR Integration: Effortlessly add MudBlazor components to your static SSR pages, saving development time.
  • Focus on Forms: Streamline development of forms and edit forms, for use cases such as Microsoft Identity Login forms.
  • Preserved Look & Feel: Maintains the consistent design and user experience of MudBlazor. Ensuring uniformity across all pages.
  • Maintains Flexibility: By inheriting core MudBlazor components, StaticInput maintains the same flexibility as the original components.

🎁 What's Included 🎁

The set of components and features may extend over time. Currently, StaticInput components include:

MudStaticButton

A Material Design button that supports form actions such as 'submit' and 'reset'
<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

Checkboxes are a great way to allow the user to make a selection of choices.
<MudStaticCheckBox @bind-Value="@RememberMe" Color="Color.Success">Remember Me</MudStaticCheckBox>
@code{
    public bool RememberMe { get; set; }
}

MudStaticSwitch

Similar to a checkbox but visually different. The switch lets the user switch between two values with the tap of a button.
<MudStaticSwitch @bind-Value="@RememberMe" Color="Color.Success" UnCheckedColor="Color.Primary">Remember Me</MudStaticSwitch>
@code{
    public bool RememberMe { get; set; }
}

MudStaticTextField

Text field components are used for receiving user provided information
<MudStaticTextField @bind-Value="@Password" 
                    InputType="InputType.Password" 
                    Adornment="Adornment.End" 
                    AdornmentIcon="@Icons.Material.Outlined.VisibilityOff" 
                    AdornmentClickFunction="showPassword" />
@code {
    public string Password { get; set; }
}
<script>
   let timeoutId;

   function showPassword(inputElement, button) {
       if (inputElement.type === 'password') {
           inputElement.type = 'text';
           clearTimeout(timeoutId);
           timeoutId = setTimeout(function () {
               inputElement.type = 'password';
           }, 5000);
       } else {
           inputElement.type = 'password';
           clearTimeout(timeoutId);
       }
   }
</script>

🚀 Getting Started 🚀

To start using MudBlazor.StaticInput in your projects, simply install the package via NuGet Package Manager:

dotnet add package Extensions.MudBlazor.StaticInput

Then add the following to the body of your App.razor file

 <script src="_content/Extensions.MudBlazor.StaticInput/NavigationObserver.js"></script>

Note: MudBlazor should already be setup for your application