Skip to main content
U.S. flag

An official website of the United States government

Dot gov

The .gov means it’s official.
Federal government websites often end in .gov or .mil. Before sharing sensitive information, make sure you’re on a federal government site.

Https

The site is secure.
The https:// ensures that you are connecting to the official website and that any information you provide is encrypted and transmitted securely.

Components

Alert - Expandable

Use with caution: Candidate
A minimized alert style that can be used to alert a user to relevant information on the page that is not prompted by their own action.
Contributors
Leyda Hughes (VSA Facilities Team)

Alert - Expandable is a mobile friendly alert component that combines the Additional Info component within the Background-Color Only Alert color schemes.

Examples

Default (Informational)

View va-alert-expandable in Storybook

Warning alert

View va-alert-expandable in Storybook

Usage

When to use Alert - Expandable

  • Unprompted alerts. - A standard Alert should only appear when prompted by a user action. By contrast, Alert - Expandable is only to be used when a user action has NOT prompted the alert. In other words, the Alert - Expandable is already present when the user loads the page.
  • In-page alerts. - A standard Alert should only be placed at the top of the page. By contrast, Alert - Expandable is only to be used within the contents of a page, not as a page-level alert. Thus it should be used sparingly to drive a user’s attention to important information related to the section it appears within. For example, this component has been used to highlight copay charges that are due.
  • Provide more information without leaving the page. The more minimal style of the collapsed Alert - Expandable is intended to be less visually prominent than a standard Alert in order to not conflict with an Alert should it appear on the same page. It allows for providing more important information once expanded that can inform the user of an important situation.

When to consider something else

  • User feedback. Use the Alert component when responding to an action taken by a user such as submitting a form.
  • Clarifying background information. Use the Additional info component when clarifying outcomes for an input or a form question as well as providing background information. Keep in mind that Alert - Expandable should warrant an alert and be used sparingly. The value of any type of alert is diminished if the page is littered with alerts of equal weight.

Behavior

Choosing between variations

  • Warning. Just like the standard Alert, the Warning variation is used to warn a user, such as when there are negative consequences, or when something has gone wrong.
  • Informational. Just like the standard Alert, the Informational default variation is used to provide helpful information or something that warrants a user’s attention. It is not used for negative consequences.

Placement

  • Alert - Expandable must only appear within a section of a page, not at the top so as not to compete with the standard Alert placement.

Instances of this component in production

Facility status for COVID-19 in Location finder

Alert - Expandable in a mobile viewport.
Alert - Expandable, default variation, collapsed in the Location finder results list.

Facility status for COVID-19 in Facility page

Alert - Expandable in a desktop viewport.
Alert - Expandable, default variation, expanded in a Facility page in a wide viewport.

Code usage

Attributes and Properties

Property Attribute Type Default Description
disableAnalytics disable-analytics boolean false If `true`, doesn't fire the CustomEvent which can be used for analytics tracking.
iconless iconless boolean false If `true`, the status icon is removed.
status status "continue" | "error" | "info" | "success" | "warning" Determines the icon and background color. One of `info`, `error`, `success`, `warning`, or `continue`
trigger trigger string The text to trigger the expansion

Events

Name Description
component-library-analytics The event used to track usage of the component. This is emitted when an anchor link is clicked and disableAnalytics is not true.
resize

Accessibility considerations

  • Icon: Must provide alternative text (use sr-only text or an aria-label) so screen readers have an equivalent understanding of the purpose/nature of the message
  • Heading: e.g. “Facility closed” should be one heading level below its parent

Research

Medical copay enhancement tool usability - July 2021

The alert was tested as part of a usability study with 9 participants. The alert was used to display copay charges referred to the Department of Treasury that needed to be resolved ASAP, so it was pertinent that the alert was immediately noticeable by Veterans.

View the component in the prototype here.

Findings

  • The alert was often the first thing Veterans noticed when arriving on the page
  • Some clicked on the alert to read more about the referred charge while others moved on to looking at other sections of the prototype
  • Veterans generally understood that they could interact with the alert. However, one asked themselves, “Can I click on this?” before clicking on it. That may have been because they were interacting with a prototype where not every element was interactive rather than because they were unsure that the alert was clickable in general.
Edit this page in GitHub (Permissions required)
Last updated: Aug 02, 2022