Skip to main content
Elastic UI
Elastic UI
Getting startedComponentsPatternsContentData visualization
EUI ChangelogGitHubFigma
  • Overview
  • Elastic AI Assistant
  • Error messages
    • Help users avoid errors
    • How to write good error messages
    • Error page
    • Error banner
    • Validation errors
    • Error warning
    • Error examples
  • Help content
  • Save buttons
  • Tables
  • EUI
  • Error messages
  • Validation errors

Validation errors


Use validation errors when the user enters information in a different format than what the system expects.

A red banner which reads, you must fix the following, your email must contain an @ character, and the date you registered must be in the past. Below that are two text inputs which the error relate to, also highlighted in red.

When to use this pattern

Validation errors should be shown when the user enters information in a different format than what the system expects. The user must fix them before they can continue.

For example:

  • leaving a text box empty
  • a typo, such as forgetting the ‘@’ symbol in an email address
  • not selecting an option from a list of checkboxes

When not to use this pattern

Do not use a validation error for any kind of error other than user input.

Instead, use one of the following:

  • error page pattern
  • error banner pattern
  • error warning pattern

How it works

There are several steps to creating a good user experience for validation errors.

  1. Display an error summary explaining the issues
  2. Link to the fields which caused the errors
  3. Highlight the fields which caused the errors
  4. Explain how to fix each field

Error summary

Error summaries must be highly visible. Use the EuiCallout component, and the props:

  • color="danger"
  • iconType="alert"

In the callout:

  • inform the user there are errors they need to fix
  • list all the things they need to fix
  • link the explanations to the correct field using it’s ID

Example: A red banner which reads, you must fix the following, your email must contain an @ character. The date you registered must be in the past.

Text inputs

Use the EuiFieldText component and the prop isInvalid=true render the error styles.

Use the EuiFormRow to display the error message alongside the field. Make sure the error message on the field matches the error message in the summary, so it’s obvious which field caused which error.

A text input with the label 'Email'. An error message in red text positioned below the field reads, 'your email must contain an @ character'

Help improve this pattern

To help make sure that this page is useful, relevant and up to date, you can join our #ux‑wg‑patterns discussions on Slack.

Edit this page

Previous
Error banner
Next
Error warning
  • When to use this pattern
  • When not to use this pattern
  • How it works
    • Error summary
    • Text inputs
  • Help improve this pattern
EUI is dual-licensed under Elastic License 2.0 and Server Side Public License, v 1 | Crafted with ❤ by Elastic