A stacked notification bar for displaying multiple flash messages. — <cs-flashbar>
Note: The
itemsproperty must be set via JavaScript as it accepts an array of objects.
<cs-flashbar id="my-flashbar"></cs-flashbar>
<script>
document.getElementById('my-flashbar').items = [
{ type: 'success', content: 'Instance created successfully.' },
{ type: 'error', content: 'Failed to delete resource.' },
];
</script>
i18n-stringsFlashbarProps.I18nStringsAn object containing all the necessary localized strings required by the component. The object should contain:
ariaLabel - Specifies the ARIA label for the list of notifications.If stackItems is set to true, it should also contain:
notificationBarAriaLabel - (optional) Specifies the ARIA label for the notification barnotificationBarText - (optional) Specifies the text shown in the notification barerrorIconAriaLabel - (optional) Specifies the ARIA label for the icon displayed next to the number of items of type error.warningIconAriaLabel - (optional) Specifies the ARIA label for the icon displayed next to the number of items of type warning.infoIconAriaLabel - (optional) Specifies the ARIA label for the icon displayed next to the number of items of type info.successIconAriaLabel - (optional) Specifies the ARIA label for the icon displayed next to the number of items of type success.inProgressIconAriaLabel - (optional) Specifies the ARIA label for the icon displayed next to the number of items of type in-progress or with loading set to true.itemsReadonlyArray<FlashbarProps.MessageDefinition>requiredSpecifies flash messages that appear in the same order that they are listed. The value is an array of flash message definition objects.
A flash message object contains the following properties:
header (unknown) - Specifies the heading text.content (unknown) - Specifies the primary text displayed in the flash element.type (string) - Indicates the type of the message to be displayed. Allowed values are as follows: success, error, warning, info, in-progress. The default is info.loading (boolean) - Replaces the status icon with a spinner and forces the type to info.dismissible (boolean) - Determines whether the component includes a close button icon. By default, the close button is not included.
When a user clicks on this button the onDismiss handler is called.dismissLabel (string) - Specifies an aria-label for to the dismiss icon button for improved accessibility.statusIconAriaLabel (string) - Specifies an aria-label for to the status icon for improved accessibility.
If not provided, i18nStrings.{type}IconAriaLabel will be used as a fallback.ariaRole (string) - For flash messages added after page load, specifies how this message is communicated to assistive
technology. Use "status" for status updates or informational content. Use "alert" for important messages that need the
user's attention.action (unknown) - Specifies an action for the flash message. Although it is technically possible to insert any content,
our UX guidelines only allow you to add a button.buttonText (string) - Specifies that an action button should be displayed, with the specified text.
When a user clicks on this button the onButtonClick handler is called.
If the action property is set, this property is ignored. Deprecated, replaced by action.onButtonClick (event => void) - Called when a user clicks on the action button. This is not called if you create a custom button
using the action property. Deprecated, replaced by action.onDismiss (event => void) - (Optional) Called when a user clicks on the dismiss button.id (string) - Specifies a unique flash message identifier. This property is used in two ways:persistenceConfig (FlashbarProps.PersistenceConfig) - Config to persist dismiss state for dismissable Flashbar item, used only in AWS Consoles.uniqueKey (string) - This key to store the persistence state, it must be unique across your console.crossServicePersistence (boolean) - If true, the persistence state will be shared across AWS services.analyticsMetadata (FlashbarProps.ItemAnalyticsMetadata) - (Optional) Specifies additional analytics-related metadata.suppressFlowMetricEvents - Prevent this item from generating events related to flow metrics.stack-itemsbooleanSpecifies whether flash messages should be stacked.