Docs

Email Field

Email Field, an extension of Text Field, only accepts email addresses as input. If the given address is invalid, the field is highlighted in red and an error message appears underneath the input.
<HorizontalLayout theme='spacing'>
  <EmailField
    label='Email address'
    value='julia.scheider@example.com'
    errorMessage='Enter a valid email address'
    clearButtonVisible
  />
  <EmailField
    label='Email address'
    value='This is not an email'
    errorMessage='Enter a valid email address'
    clearButtonVisible
  />
</HorizontalLayout>

Common input field features

Email Field includes all Text Field and shared input field features.

Pattern for additional validation

The pattern attribute is an additional validation criterion that you can set if, for example, a specific domain is required. The pattern is specified using a regular expression.

The example below uses the pattern .+@example\.com and only accepts addresses in the example.com domain.

<EmailField
  label='Email address'
  value='julia@example.com'
  errorMessage='Enter a valid email address'
  pattern='^.+@example\.com$'
/>