# RadzenEmailValidator Class

A validator component that verifies whether a text input contains a valid email address format. RadzenEmailValidator uses the .NET EmailAddressAttribute to validate email format according to standard rules. Must be placed inside a [RadzenTemplateForm<T>](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenTemplateForm-1.md) and associated with a named input component. Checks email format using System.ComponentModel.DataAnnotations.EmailAddressAttribute validation rules. Empty or null values are considered valid - combine with [RadzenRequiredValidator](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenRequiredValidator.md) to ensure the field is not empty. The validation runs when the form is submitted or when the component loses focus.

Namespace: [Radzen.Blazor](https://blazor.radzen.com/docs/api/Radzen.Blazor.md)

Assembly: Radzen.Blazor.dll

## Inheritance

- Object
- ComponentBase
- [RadzenComponent](https://blazor.radzen.com/docs/api/Radzen.RadzenComponent.md)
- [ValidatorBase](https://blazor.radzen.com/docs/api/Radzen.Blazor.ValidatorBase.md)
- RadzenEmailValidator

## Implements

- IComponent
- IHandleEvent
- IHandleAfterRender
- [IRadzenFormValidator](https://blazor.radzen.com/docs/api/Radzen.IRadzenFormValidator.md)

## Syntax

```csharp
public class RadzenEmailValidator : ValidatorBase, IComponent, IHandleEvent, IHandleAfterRender, IRadzenFormValidator
```

## Examples

Basic email validation:

```razor
<RadzenTemplateForm TItem="Model" Data=@model>
  <RadzenTextBox style="display: block" Name="Email" @bind-Value=@model.Email />
  <RadzenEmailValidator Component="Email" Text="Please enter a valid email address" Style="position: absolute" />
</RadzenTemplateForm>
@code {
 class Model
  {
   public string Email { get; set; }
 }

 Model model = new Model();
}
```

Combined with required validator:

```razor
<RadzenTextBox Name="Email" @bind-Value=@model.Email />
<RadzenRequiredValidator Component="Email" Text="Email is required" />
<RadzenEmailValidator Component="Email" Text="Invalid email format" />
```

## Constructors

| Constructor | Description |
|-------------|-------------|
| `public RadzenEmailValidator()` | A validator component that verifies whether a text input contains a valid email address format. RadzenEmailValidator uses the .NET EmailAddressAttribute to validate email format according to standard rules. Must be placed inside a [RadzenTemplateForm<T>](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenTemplateForm-1.md) and associated with a named input component. Checks email format using System.ComponentModel.DataAnnotations.EmailAddressAttribute validation rules. Empty or null values are considered valid - combine with [RadzenRequiredValidator](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenRequiredValidator.md) to ensure the field is not empty. The validation runs when the form is submitted or when the component loses focus. |

## Properties

| Property | Type | Description |
|------|------|-------------|
| Text | `string` | Gets or sets the error message displayed when the email address format is invalid. Customize this message to provide clear feedback to users about the expected email format. |

## Methods

| Method | Returns | Description |
|------|---------|-------------|
| `Validate(IRadzenFormComponent component)` | `bool` |  |

## Inherited Members

- From [ValidatorBase](https://blazor.radzen.com/docs/api/Radzen.Blazor.ValidatorBase.md): BuildRenderTree, Component, Dispose, EditContext, Form, GetComponentCssClass, IsValid, OnAfterRenderAsync, Popup, PopupPosition, SetParametersAsync, messages
- From [RadzenComponent](https://blazor.radzen.com/docs/api/Radzen.RadzenComponent.md): AddContextMenu, Attributes, ContextMenu, Culture, CurrentStyle, Debounce, DefaultCulture, DefaultUICulture, Element, GetCssClass, GetId, GetIdAttribute, IsJSRuntimeAvailable, JSRuntime, Localize, MouseEnter, MouseLeave, OnBecameInvisible, OnContextMenu, OnInitialized, OnMouseEnter, OnMouseLeave, RaiseContextMenu, RaiseMouseEnter, RaiseMouseLeave, Reference, Style, UICulture, UniqueID, Visible
- From ComponentBase: Assets, AssignedRenderMode, DispatchExceptionAsync, InvokeAsync, OnAfterRender, OnInitializedAsync, OnParametersSet, OnParametersSetAsync, RendererInfo, ShouldRender, StateHasChanged

