AstrolUI AstrolUI
Yellow Orange Red Green Blue Purple Custom color
Light mode
InputPassword

1. Demo AstrolInputPassword using EditForm

Note:
In this example, notifications, buttons, labels, and content inputs are implemented. It is recommended to refer to the documentation for each of them.
@using Astrol.Component.Basic.Button
@using Astrol.Component.Basic.Form
@using System.ComponentModel.DataAnnotations
@using Astrol.Entities.Basic.Static.Notification
@using Astrol.Entities.Basic.UI
@using Astrol.JSInterop.Base
@inject AstrolJSInterop jsI
 
<EditForm Model="@login" OnValidSubmit="@HandleValidSubmit">
   <DataAnnotationsValidator />
   <div class="form-control-file">
       <AstrolLabel TItem="Login" For="@nameof(login.Password)" />
       <AstrolInputPassword @bind-Value="@login.Password" Id="@nameof(login.Password)" Class="form-control"/>
       <ValidationMessage For="@(() => login.Password)" />
   </div>
   <AstrolButton Type="ButtonType.Submit" Text="Send" Style="AstrolStyle.Blue" Class="fr" />
</EditForm>
@code {
   public class Login { 
       [Display(Name = "Password")]
       [Required(ErrorMessage = "Password required.")]
       [MinLength(6, ErrorMessage = "Minimum length of 6 characters.")]
       public string Password { get; set; } = string.Empty;
   }
   private Login login = new Login();
   private async Task HandleValidSubmit() {
       await jsI.Notification("Sending form".NotificationSuccess("astrol-ok"));
   }
}

Supported parameters

  • Value (string), the password; bind it with @bind-Value (required). It inherits InputBase<string>: inside an EditForm it takes part in validation (DataAnnotationsValidator, ValidationMessage).
  • Id (string), HTML id of the input (to link a label).
  • Class (string), extra css class for the input.
  • Placeholder (string), input placeholder.
  • ShowPassword (bool), shows the password initially; the user can toggle it with the lock icon (default false).
  • Autocomplete (bool), allows browser autocomplete; with false it uses autocomplete="new-password" (default true).
  • IconAriaLabel (string), accessible text of the show/hide button (default follows the app language).
  • HasShadow (bool) and FocusRing (bool), shadow and effect of the AstrolContentInput container (default true).
  • Other attributes (e.g. maxlength, required, autofocus) are applied to the input.
Markdown for AI © 2026 AstrolUI v10.0.13