MessageStrip
v0.9.0
@ui5/webcomponents
<ui5-message-strip>

MessageStrip

Information MessageStrip Positive MessageStrip Negative MessageStrip Warning MessageStrip
<ui5-message-strip design="Information">Information MessageStrip</ui5-message-strip>
<ui5-message-strip design="Positive">Positive MessageStrip</ui5-message-strip>
<ui5-message-strip design="Negative">Negative MessageStrip</ui5-message-strip>
<ui5-message-strip design="Warning">Warning MessageStrip</ui5-message-strip>
<script>
	document.querySelectorAll("ui5-message-strip").forEach(function(messageStrip) {
		messageStrip.addEventListener("close", function() {
			messageStrip.parentNode.removeChild(messageStrip);
		});
	});
</script>
	

MessageStrip With No Close Button

Information MessageStrip With No Close Button Positive MessageStrip With No Close Button Negative MessageStrip With No Close Button Warning MessageStrip With No Close Button
<ui5-message-strip design="Information" hide-close-button>Information MessageStrip With No Close Button</ui5-message-strip>
<ui5-message-strip design="Positive" hide-close-button>Positive MessageStrip With No Close Button</ui5-message-strip>
<ui5-message-strip design="Negative" hide-close-button>Negative MessageStrip With No Close Button</ui5-message-strip>
<ui5-message-strip design="Warning" hide-close-button>Warning MessageStrip With No Close Button</ui5-message-strip>
	

MessageStrip With No Icon

Information MessageStrip With No Icon Positive MessageStrip With No Icon Negative MessageStrip With No Icon Warning MessageStrip With No Icon
<ui5-message-strip design="Information" hide-icon>Information MessageStrip With No Icon</ui5-message-strip>
<ui5-message-strip design="Positive" hide-icon>Positive MessageStrip With No Icon</ui5-message-strip>
<ui5-message-strip design="Negative" hide-icon>Negative MessageStrip With No Icon</ui5-message-strip>
<ui5-message-strip design="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
		<div class="wrapper">
			<ui5-button id="button1">Generate MessageStrip</ui5-button>
		</div>
		<script>
			const container = document.querySelector(".wrapper");
			const button =  document.querySelector("#button1");
			button.addEventListener("click", function(event) {
				let invisibleMessage =  window["sap-ui-webcomponents-bundle"].invisibleMessage;
				const messageStrip = document.querySelector("#msgStrip");
				const types = ["Information", "Warning", "Negative", "Positive"];
				const text = "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.";
				let type = types[Math.round(Math.random() * 3)];
		
				if (messageStrip) {
					container.removeChild(messageStrip);
				}
		
				let generatedMsgStrip = 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 icon Custom animated gif
<ui5-message-strip design="Information" style="width: 200px;" hide-icon hide-close-button>You have new message.</ui5-message-strip>
<ui5-message-strip design="Positive" style="width: 200px;" hide-close-button>Successfull login!</ui5-message-strip>
<ui5-message-strip design="Negative" style="width: 200px;" hide-icon>Access denied!</ui5-message-strip>
<ui5-message-strip design="Warning" style="width: 200px;">Update is required.</ui5-message-strip>
<ui5-message-strip design="Warning" style="width: 200px;"><ui5-icon name="palette" slot="icon"></ui5-icon>Custom icon</ui5-message-strip>
<ui5-message-strip design="Positive" style="width: 200px;"><img src="../../../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 Black Horizon High Contrast White Quartz Light Quartz Dark Quartz High Contrast Black Quartz High Contrast White
Content Density: Cozy Compact
Text Direction: LTR RTL
Apply Cancel