Skip to main content
Give us your valuable feedback

It will help us understand how we can serve you better

Give feedback

Components

Alert

Alert are to display a list of options on a temporary surface

banner-Alert

Anatomy

The Alert component is used to display important information or alerts to users. It is commonly used for information, warnings, errors, success messages, and notifications.

anatomy alert
  1. Heading: The Alert type refers to the type of alert being displayed, such as success, warning, error or info. It can be indicated by a specific color or icon, depending on the design.
  2. Alert Type: The icon is an optional element that can be included in an Alert component to reinforce the type of the alert being displayed.
  3. Container: The container is the outermost element that holds the alert component. It can be a div or any other appropriate HTML element.
  4. Message: The message is the text content of the Alert component that conveys the important information to the user. It should be clear, concise and easy to read.
  5. Close button: The close button is an optional element that allows the user to dismiss the alert once they have read it. It can be indicated by an X icon or any other appropriate symbol.

Usage

The Alert component is used to provide users with important information or alerts. It is commonly used in web applications, online forms, and other contexts where users need to be notified of changes or errors.

When to use

  • Error messages: When a user encounters an error or a problem while using the application or website, an Alert component can be used to provide information about the issue and offer a solution.
  • Confirmation messages: When a user performs an action that has significant consequences, such as deleting data or making a payment, an Alert component can be used to confirm the action and provide further instructions.
  • Notifications: When there is important information that the user needs to be aware of, such as changes to account settings or new features, an Alert component can be used to notify them.

When not to use

  • Informational messages: If the message is not urgent or important and does not require immediate attention, an Alert component may not be necessary. In such cases, a less intrusive method such as a tooltip or a banner might be more appropriate.
  • Warnings: If the message is a warning that does not require immediate attention, a different type of component, such as a modal or a popover, might be more appropriate.
  • Success messages: While success messages can be displayed using an Alert component, they might be better suited to a different type of component such as a banner or a status indicator.

Accessibility

Accessibility is an important consideration when designing and implementing the Alert component to ensure that it can be used effectively by all users. Here are some accessibility consideration for Alert:

  • Use clear and concise text: The text used in the Alert component should be easy to read and understand, with a font size and color contrast that meet accessibility standards.
  • Ensure proper color contrast: Make sure the color of the Alert component contrasts sufficiently with the background color to make it visible to users with color blindness or low vision. WCAG recommends a minimum contrast ratio of 4.5:1 between text and background.
  • Use ARIA attributes: Use ARIA attributes to label the Alert component as an alert and provide additional context for screen readers.
  • Include a focus indicator: Ensure that the Alert component has a focus indicator that is visible and easily identifiable by keyboard users. This will help users who navigate the website or application using a keyboard.
  • Allow enough time for users to read the message: Users may require more time to read the Alert message due to a disability. Ensure that the Alert remains visible for an appropriate amount of time to allow users to read and process the information.
  • Use descriptive icons: If icons are used in the Alert component, make sure they are descriptive and not reliant on color alone to convey meaning. This will help users with visual impairments or color blindness to understand the Alert’s type.
  • Test with assistive technology: Test the Alert component with assistive technology such as screen readers and keyboard-only navigation to ensure that it is accessible to users with disabilities.
Alt text

Do

Use clear and concise language for the alert message.

Alt text

Don't

Use unclear or misleading language for the alert message.

Content

When creating Alert:

  • Use clear and direct language: The language used in the Alert should be easy to understand and free of technical jargon or industry-specific terms that may be confusing to the user.
  • Keep it short: The message should be brief and to the point, conveying the essential information in a concise manner.
  • Provide clear instructions: If the Alert requires the user to take action, provide clear instructions on what they need to do next. Use actionable language and provide a link or button to take the required action.
  • Use a conversational tone: Using a conversational tone in the Alert message can make it feel more personal and less intimidating to the user.
  • Be specific and relevant: The Alert should be specific to the action or event that triggered it, and the information provided should be relevant to the user.
  • Avoid unnecessary information: Do not include information that is not relevant to the Alert, as it can be distracting and confusing to the user.
  • Use a consistent tone: The tone of the Alert should be consistent with the tone used throughout the application or website. If the Alert is urgent or critical, use appropriate language and tone to convey this.
  • Test the content: Test the Alert message with users to ensure that it is clear, understandable, and effective in communicating the required information.
Alt text

Do

The message should be brief and to the point, conveying the essential information in a concise manner.

Alt text

Don't

The message is long and didn't point out the message clearly, conveying the non-essential information.