eds-alert

Explore the Interactive Component

Use the playground below to experiment with the component. Click the button to view the full Storybook deployment for additional examples and configurations.

eds-alert Open in Storybook

See It in Use with Code

Check out this practical implementation of component.

Dismissible Alert

Set dismissible to show a close button. The component emits an edsDismiss event when it is dismissed:

Passing values in Vue 3

The .prop modifier in Vue ensures that you’re binding the property directly on the custom element, rather than setting it as an HTML attribute.

Because HTML attributes are case-insensitive, they could be converted to pressablelabel and pressableurl, and the Stencil component might not correctly map those to the pressableLabel and pressableUrl properties.

Intents

intentUse forLook
defaultA neutral noteRaised white card
infoGeneral informationGrey tint, info icon
warningCaution, review neededAmber tint
errorFailure, invalid inputRed tint
successConfirmation, completed actionGreen tint
brandEBRAINS-branded messagingBrand black, neon icon

Actions and Layout

  • With pressable-url, the action is an outlined pill link with an arrow; with only pressable-label, it is a secondary pill button (listen for edsalert).
  • Use direction="vertical" for longer messages or when the action needs its own line.
  • For rich text, put HTML in the default slot instead of message.

Overview

EdsAlert is a versatile alert component for displaying contextual messages.

Key features:

  • Contextual intents (default, info, warning, error, success) with matching icons and accent colors
  • Configurable layout direction (horizontal or vertical)
  • Optional action element (link when URL provided, ghost button otherwise)
  • Optional dismiss button to close the alert
  • Optional bold heading above the message
  • Tinted status surface per intent (semantic status tokens), adapts to the dark theme

Properties

PropertyAttributeDescriptionTypeDefault
directiondirectionThe layout direction of the alert content."horizontal" | "vertical"'horizontal'
dismissibledismissibleWhen true, shows a close button to dismiss the alert.booleanfalse
headingheadingOptional bold heading shown above the message.stringundefined
iconiconOptional icon override. When not set, an icon matching the intent is shown automatically."copy" | "arrow-right" | "chevron-right" | "chevron-left" | "chevron-down" | "chevron-up" | "arrow-left" | "arrow-up-right" | "close" | "subtract" | "add" | "branch" | "history" | "locked" | "unlocked" | "edit" | "checkmark" | "download" | "upload" | "view" | "exit" | "caretSort" | "bookmark" | "createLink" | "activity" | "account" | "analytics" | "template" | "documentExport" | "documentDownload" | "trashCan" | "chooseItem" | "copyLink" | "dragHorizontal" | "dragVertical" | "login" | "logout" | "move" | "replicate" | "sortAscending" | "sortDescending" | "requestQuote" | "reset" | "resultDraft" | "share" | "play" | "book" | "chatOff" | "forum" | "shareKnowledge" | "time" | "help" | "customerService" | "code" | "rocket" | "compass" | "sparkle" | "menu" | "search" | "settings" | "notification" | "user" | "group" | "building" | "overflow" | "save" | "document" | "folder" | "image" | "calendar" | "information" | "warning" | "error" | "checkmark-filled" | "star" | "thumbs-up" | "thumbs-down" | "star-outline" | "thumbs-up-outline" | "thumbs-down-outline" | "twitter" | "linkedin" | "facebook" | "youtube" | "mastodon" | "bluesky" | "gitlab"undefined
intentintentThe visual intent of the alert. ‘info’ is an alias for ‘default’."brand" | "default" | "error" | "info" | "success" | "warning"'default'
messagemessageThe main message or text to be displayed in the alert. If not provided, slot content will be used instead.stringundefined
pressableLabelpressable-labelLabel for the action element (link or button).stringundefined
pressableUrlpressable-urlURL for the action element. When provided, renders a link instead of a button.stringundefined

Events

EventDescriptionType
edsalertEmitted when the alert action button is clicked (for non-URL actions).CustomEvent<void>
edsDismissEmitted when the alert is dismissed.CustomEvent<void>

Dependencies

Used by

Depends on

Graph

graph TD;
  eds-alert --> eds-icon-wrapper
  eds-alert --> eds-link
  eds-alert --> eds-button
  eds-link --> eds-icon-wrapper
  eds-button --> eds-icon-wrapper
  components-section --> eds-alert
  eds-kg-learning-resources --> eds-alert
  incorrect-use-of-colors --> eds-alert
  style eds-alert fill:#f9f,stroke:#333,stroke-width:4px

Built with StencilJS