Class RadzenLogin
A pre-built login form component with username/password fields and optional "Remember Me", "Register", and "Reset Password" features. RadzenLogin provides a ready-to-use authentication UI that can be customized with events for login, registration, and password reset flows. Must be placed inside a RadzenTemplateForm<TItem>. Eliminates the need to manually create login forms by providing a complete, styled login interface. Features pre-configured text and password inputs, optional switch for persistent sessions (Remember Me), optional link to registration page/modal, optional link for password recovery (Reset Password), browser password manager integration with autocomplete, customizable labels/button text/layout via parameters, Login/Register/ResetPassword event callbacks for implementing auth logic, and built-in required field validation. Handle the Login event to authenticate users with your backend. Use AllowRegister and AllowResetPassword to show/hide those links based on your auth requirements.
Inherited Members
Namespace: Radzen.Blazor
Assembly: Radzen.Blazor.dll
Syntax
public class RadzenLogin : RadzenComponent, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
Examples
Basic login form:
<RadzenTemplateForm Data=@("Login")>
<RadzenLogin Login=@OnLogin />
</RadzenTemplateForm>
@code {
async Task OnLogin(LoginArgs args)
{
// Authenticate with backend
var result = await authService.Login(args.Username, args.Password);
if (result.Success)
NavigationManager.NavigateTo("/dashboard");
}
}
Full-featured login with all options:
<RadzenTemplateForm Data=@("Login")>
<RadzenLogin AllowRegister="true" AllowResetPassword="true"
Login=@OnLogin Register=@OnRegister ResetPassword=@OnResetPassword
UserText="Email" RememberMe="true" />
</RadzenTemplateForm>
Constructors
RadzenLogin()
A pre-built login form component with username/password fields and optional "Remember Me", "Register", and "Reset Password" features. RadzenLogin provides a ready-to-use authentication UI that can be customized with events for login, registration, and password reset flows. Must be placed inside a RadzenTemplateForm<TItem>. Eliminates the need to manually create login forms by providing a complete, styled login interface. Features pre-configured text and password inputs, optional switch for persistent sessions (Remember Me), optional link to registration page/modal, optional link for password recovery (Reset Password), browser password manager integration with autocomplete, customizable labels/button text/layout via parameters, Login/Register/ResetPassword event callbacks for implementing auth logic, and built-in required field validation. Handle the Login event to authenticate users with your backend. Use AllowRegister and AllowResetPassword to show/hide those links based on your auth requirements.
Declaration
public RadzenLogin()
Examples
Basic login form:
<RadzenTemplateForm Data=@("Login")>
<RadzenLogin Login=@OnLogin />
</RadzenTemplateForm>
@code {
async Task OnLogin(LoginArgs args)
{
// Authenticate with backend
var result = await authService.Login(args.Username, args.Password);
if (result.Success)
NavigationManager.NavigateTo("/dashboard");
}
}
Full-featured login with all options:
<RadzenTemplateForm Data=@("Login")>
<RadzenLogin AllowRegister="true" AllowResetPassword="true"
Login=@OnLogin Register=@OnRegister ResetPassword=@OnResetPassword
UserText="Email" RememberMe="true" />
</RadzenTemplateForm>
Properties
AllowRegister
Gets or sets a value indicating whether register is allowed.
Declaration
[Parameter]
public bool AllowRegister { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
AllowRememberMe
Asks the user whether to remember their credentials. Set to false by default.
Declaration
[Parameter]
public bool AllowRememberMe { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
AllowResetPassword
Gets or sets a value indicating whether reset password is allowed.
Declaration
[Parameter]
public bool AllowResetPassword { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
AutoComplete
Gets or sets a value indicating whether automatic complete of inputs is enabled.
Declaration
[Parameter]
public bool AutoComplete { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
FormFieldVariant
Gets or sets the design variant of the form field.
Declaration
[Parameter]
public Variant? FormFieldVariant { get; set; }
Property Value
| Type | Description |
|---|---|
| Variant? | The variant of the form field. |
Login
Gets or sets the login callback.
Declaration
[Parameter]
public EventCallback<LoginArgs> Login { get; set; }
Property Value
| Type | Description |
|---|---|
| EventCallback<LoginArgs> | The login callback. |
LoginText
Gets or sets the login text.
Declaration
[Parameter]
public string LoginText { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The login text. |
Password
Gets or sets the password.
Declaration
[Parameter]
public string Password { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The password. |
PasswordAutoCompleteType
Gets or sets a value indicating the type of built-in autocomplete the browser should use. AutoCompleteType
Declaration
[Parameter]
public AutoCompleteType PasswordAutoCompleteType { get; set; }
Property Value
| Type | Description |
|---|---|
| AutoCompleteType | The type of built-in autocomplete. |
PasswordRequired
Gets or sets the password required.
Declaration
[Parameter]
public string PasswordRequired { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The password required. |
PasswordText
Gets or sets the password text.
Declaration
[Parameter]
public string PasswordText { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The password text. |
Register
Gets or sets the register callback.
Declaration
[Parameter]
public EventCallback Register { get; set; }
Property Value
| Type | Description |
|---|---|
| EventCallback | The register callback. |
RegisterMessageText
Gets or sets the register message text.
Declaration
[Parameter]
public string RegisterMessageText { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The register message text. |
RegisterText
Gets or sets the register text.
Declaration
[Parameter]
public string RegisterText { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The register text. |
RememberMe
Sets the initial value of the remember me switch.
Declaration
[Parameter]
public bool RememberMe { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
RememberMeText
Gets or sets the remember me text.
Declaration
[Parameter]
public string RememberMeText { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
ResetPassword
Gets or sets the reset password callback.
Declaration
[Parameter]
public EventCallback<string> ResetPassword { get; set; }
Property Value
| Type | Description |
|---|---|
| EventCallback<string> | The reset password callback. |
ResetPasswordText
Gets or sets the reset password text.
Declaration
[Parameter]
public string ResetPasswordText { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The reset password text. |
ShowLoginButton
Gets or sets a value indicating whether default login button is shown.
Declaration
[Parameter]
public bool ShowLoginButton { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
UserNameAutoCompleteType
Gets or sets a value indicating the type of built-in autocomplete the browser should use. AutoCompleteType
Declaration
[Parameter]
public AutoCompleteType UserNameAutoCompleteType { get; set; }
Property Value
| Type | Description |
|---|---|
| AutoCompleteType | The type of built-in autocomplete. |
UserRequired
Gets or sets the user required text.
Declaration
[Parameter]
public string UserRequired { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The user required text. |
UserText
Gets or sets the user text.
Declaration
[Parameter]
public string UserText { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The user text. |
Username
Gets or sets the username.
Declaration
[Parameter]
public string Username { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The username. |
Methods
BuildRenderTree(RenderTreeBuilder)
A pre-built login form component with username/password fields and optional "Remember Me", "Register", and "Reset Password" features. RadzenLogin provides a ready-to-use authentication UI that can be customized with events for login, registration, and password reset flows. Must be placed inside a RadzenTemplateForm<TItem>. Eliminates the need to manually create login forms by providing a complete, styled login interface. Features pre-configured text and password inputs, optional switch for persistent sessions (Remember Me), optional link to registration page/modal, optional link for password recovery (Reset Password), browser password manager integration with autocomplete, customizable labels/button text/layout via parameters, Login/Register/ResetPassword event callbacks for implementing auth logic, and built-in required field validation. Handle the Login event to authenticate users with your backend. Use AllowRegister and AllowResetPassword to show/hide those links based on your auth requirements.
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
| Type | Name | Description |
|---|---|---|
| RenderTreeBuilder | __builder |
Overrides
GetComponentCssClass()
Gets the component CSS class.
Declaration
protected override string GetComponentCssClass()
Returns
| Type | Description |
|---|---|
| string |
Overrides
OnInitialized()
Called by the Blazor runtime.
Declaration
protected override void OnInitialized()
Overrides
OnLogin()
Called when login.
Declaration
protected Task OnLogin()
Returns
| Type | Description |
|---|---|
| Task |
OnRegister()
Called when register.
Declaration
protected Task OnRegister()
Returns
| Type | Description |
|---|---|
| Task |
OnReset(EventArgs)
Handles the Reset event.
Declaration
protected Task OnReset(EventArgs args)
Parameters
| Type | Name | Description |
|---|---|---|
| EventArgs | args | The EventArgs instance containing the event data. |
Returns
| Type | Description |
|---|---|
| Task |
SetParametersAsync(ParameterView)
Called by the Blazor runtime when parameters are set.
Declaration
public override Task SetParametersAsync(ParameterView parameters)
Parameters
| Type | Name | Description |
|---|---|---|
| ParameterView | parameters | The parameters. |
Returns
| Type | Description |
|---|---|
| Task |