Information MessageStrip With No Close ButtonPositive MessageStrip With No Close ButtonNegative MessageStrip With No Close ButtonWarning MessageStrip With No Close Button
<ui5-message-stripdesign="Information"hide-close-button>Information MessageStrip With No Close Button</ui5-message-strip><ui5-message-stripdesign="Positive"hide-close-button>Positive MessageStrip With No Close Button</ui5-message-strip><ui5-message-stripdesign="Negative"hide-close-button>Negative MessageStrip With No Close Button</ui5-message-strip><ui5-message-stripdesign="Warning"hide-close-button>Warning MessageStrip With No Close Button</ui5-message-strip>
MessageStrip With No Icon
Information MessageStrip With No IconPositive MessageStrip With No IconNegative MessageStrip With No IconWarning MessageStrip With No Icon
<ui5-message-stripdesign="Information"hide-icon>Information MessageStrip With No Icon</ui5-message-strip><ui5-message-stripdesign="Positive"hide-icon>Positive MessageStrip With No Icon</ui5-message-strip><ui5-message-stripdesign="Negative"hide-icon>Negative MessageStrip With No Icon</ui5-message-strip><ui5-message-stripdesign="Warning"hide-icon>Warning MessageStrip With No Icon</ui5-message-strip><script>document.querySelectorAll("ui5-message-strip").forEach(function(messageStrip){messageStrip.addEventListener("close",function(){messageStrip.parentNode.removeChild(messageStrip);});});</script>
Dynamic Message Strip Generator
Generate MessageStrip
<divclass="wrapper"><ui5-buttonid="button1">Generate MessageStrip</ui5-button></div><script>constcontainer=document.querySelector(".wrapper");constbutton=document.querySelector("#button1");button.addEventListener("click",function(event){letinvisibleMessage=window["sap-ui-webcomponents-bundle"].invisibleMessage;constmessageStrip=document.querySelector("#msgStrip");consttypes=["Information","Warning","Negative","Positive"];consttext="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua ut enim ad minim veniam, quis nostrud exercitation ullamco.";lettype=types[Math.round(Math.random()*3)];if(messageStrip){container.removeChild(messageStrip);}letgeneratedMsgStrip=document.createElement("ui5-message-strip");generatedMsgStrip.id="msgStrip";generatedMsgStrip.design=type;generatedMsgStrip.textContent=text;invisibleMessage.announce(`New Information Bar of type ${type}${text}`,"Assertive");container.appendChild(generatedMsgStrip);});</script>
Custom MessageStrip
You have new message.Successfull login!Access denied!Update is required.Custom iconCustom animated gif
<ui5-message-stripdesign="Information"style="width: 200px;"hide-iconhide-close-button>You have new message.</ui5-message-strip><ui5-message-stripdesign="Positive"style="width: 200px;"hide-close-button>Successfull login!</ui5-message-strip><ui5-message-stripdesign="Negative"style="width: 200px;"hide-icon>Access denied!</ui5-message-strip><ui5-message-stripdesign="Warning"style="width: 200px;">Update is required.</ui5-message-strip><ui5-message-stripdesign="Warning"style="width: 200px;"><ui5-iconname="palette"slot="icon"></ui5-icon>Custom icon</ui5-message-strip><ui5-message-stripdesign="Positive"style="width: 200px;"><imgsrc="../../../assets/images/loading.gif"width="16"height="16"slot="icon">Custom animated gif</ui5-message-strip><script>document.querySelectorAll("ui5-message-strip").forEach(function(messageStrip){messageStrip.addEventListener("close",function(){messageStrip.parentNode.removeChild(messageStrip);});});</script>
Overview
The ui5-message-strip component enables the embedding of app-related messages. It displays 4 designs of messages, each with corresponding semantic color and icon: Information, Positive, Warning and Negative. Each message can have a Close button, so that it can be removed from the UI, if needed.
Usage
For the ui5-message-strip component, you can define whether it displays an icon in the beginning and a close button. Moreover, its size and background can be controlled with CSS.
Keyboard Handling
Fast Navigation
This component provides a build in fast navigation group which can be used via F6 / Shift + F6 or Ctrl + Alt(Option) + Down / Ctrl + Alt(Option) + Up. In order to use this functionality, you need to import the following module: import "@ui5/webcomponents-base/dist/features/F6Navigation.js"
ES6 Module Import
import "@ui5/webcomponents/dist/MessageStrip";
Properties/Attributes
You can use both properties and attributes with the same effect. The name of each attribute is listed below the name of the property, if different.
Name
Type
Default Value
Description
design
MessageStripDesign
"Information"
Defines the component type.
Note: Available options are "Information", "Positive", "Negative", and "Warning".
since v1.0.0-rc.15
hideCloseButton
hide-close-button
boolean
false
Defines whether the MessageStrip renders close button.
hideIcon
hide-icon
boolean
false
Defines whether the MessageStrip will show an icon in the beginning. You can directly provide an icon with the icon slot. Otherwise, the default icon for the type will be used.
since v1.0.0-rc.15
Slots
This Element provides slot(s). This means it can display its child nodes.
Unless targeting the default slot, use the slot attribute to define the destination slot for each child.
Text, along with HTML Elements with no slot attribute, goes the the default slot.
Slot
Type
Description
default
Node [0..n]
Defines the text of the component.
Note: Although this slot accepts HTML Elements, it is strongly recommended that you only use text in order to preserve the intended design.
icon
HTMLElement
Defines the content to be displayed as graphical element within the component.
Note: If no icon is given, the default icon for the component type will be used. The SAP-icons font provides numerous options.
See all the available icons in the Icon Explorer.
Events
This Web Component fires semantic events upon user interaction. You can bind to these events with the standard DOM APIs, such as addEventListener.
Name
Description
close
Fired when the close button is pressed either with a click/tap or by using the Enter or Space key.
Theme:Morning Horizon (Light)Evening Horizon (Dark)Horizon High Contrast BlackHorizon High Contrast WhiteQuartz LightQuartz DarkQuartz High Contrast BlackQuartz High Contrast White