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.
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
intent | Use for | Look |
|---|---|---|
default | A neutral note | Raised white card |
info | General information | Grey tint, info icon |
warning | Caution, review needed | Amber tint |
error | Failure, invalid input | Red tint |
success | Confirmation, completed action | Green tint |
brand | EBRAINS-branded messaging | Brand black, neon icon |
Actions and Layout
- With
pressable-url, the action is an outlined pill link with an arrow; with onlypressable-label, it is a secondary pill button (listen foredsalert). - 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 (
horizontalorvertical) - Optional action element (link when URL provided, ghost button otherwise)
- Optional dismiss button to close the alert
- Optional bold
headingabove the message - Tinted status surface per intent (semantic status tokens), adapts to the dark theme
Properties
| Property | Attribute | Description | Type | Default |
|---|---|---|---|---|
direction | direction | The layout direction of the alert content. | "horizontal" | "vertical" | 'horizontal' |
dismissible | dismissible | When true, shows a close button to dismiss the alert. | boolean | false |
heading | heading | Optional bold heading shown above the message. | string | undefined |
icon | icon | Optional 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 |
intent | intent | The visual intent of the alert. ‘info’ is an alias for ‘default’. | "brand" | "default" | "error" | "info" | "success" | "warning" | 'default' |
message | message | The main message or text to be displayed in the alert. If not provided, slot content will be used instead. | string | undefined |
pressableLabel | pressable-label | Label for the action element (link or button). | string | undefined |
pressableUrl | pressable-url | URL for the action element. When provided, renders a link instead of a button. | string | undefined |
Events
| Event | Description | Type |
|---|---|---|
edsalert | Emitted when the alert action button is clicked (for non-URL actions). | CustomEvent<void> |
edsDismiss | Emitted when the alert is dismissed. | CustomEvent<void> |
Dependencies
Used by
- components-section
- eds-kg-learning-resources
- incorrect-use-of-colors
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