Banner
Banners display important information that informs the user about the status of the system. They are semantically categorized and colored to reflect the status. They are optionally dismissable. Buttons are optional, too. Banners must have at least a title or a description.
Example
Usage Rules
Do:
- Always communicate the severity of a banner in its title (e.g. using words like "error" or "warning")
Variants
Actions
The Banner can show primary and secondary actions.
Custom Description
The description
prop can be string or reactElement
When you need description to be more than a simple string text you can pass a reactElement. These are the list of allowed tags you can have in description: p, b, strong, i, ul, ol, li, a, br.
Kind
The kind
prop lets you set the severity of Banner messages and give it a semantic meaning.
The Banner component is available in five options: primary
, neutral
, positive
, warning
and negative
.
Props
Name | Type | Default |
---|---|---|
description * The body text which can be string or reactElement |
| — |
id A unique id for banner |
| — |
title A short headline |
| — |
kind The kind of the banner |
| "neutral" |
closable A cross icon button will appear which when pressed will remove the banner |
| — |
onClose The handler will be called when the close button is pressed. This can be used for instance if you want to remember the user's decision to close the Banner. This handler will be called only if closable is "true" |
| — |
primaryAction Provide an action for the user to follow-up on the message. The onClick handler will be called if the button is "pressed"(via a click or keyboard events) |
| — |
secondaryAction Provide an action for the user to follow-up on the message. The onClick handler will be called if the button is "pressed"(via a click or keyboard events) |
| — |
css Add custom styles to this component. Use with caution. Learn more here: Link |
| — |
inputFieldCss |
| — |
data-{foo} Data attributes can be used by testing libraries to retrieve components or assert their existence |
| — |
* - the prop is required. |