|
2 | 2 | title: Banner |
3 | 3 | sidebar_position: 1 |
4 | 4 | --- |
| 5 | + |
5 | 6 | # Banner |
6 | 7 |
|
| 8 | +Banners display important, brief messages and provide optional actions for users to respond to. They are designed to inform, warn, or alert users about something relevant to their current context - such as a system change, an error, or a required action. Banners are interruptive by nature, so their level of interruption should match the significance of the information they carry. |
| 9 | + |
| 10 | +<iframe |
| 11 | + class="sb-iframe" |
| 12 | + src="https://storybook.eds.equinor.com/iframe.html?globals=&args=&id=eds-2-0-beta-feedback-banner--introduction" |
| 13 | + width="100%" |
| 14 | + height="128" |
| 15 | + frameborder="1" |
| 16 | +></iframe> |
| 17 | +
|
| 18 | +[View in Storybook](https://storybook.eds.equinor.com/?path=/story/eds-2-0-beta-feedback-banner--introduction) |
| 19 | + |
7 | 20 | ## When to Use |
8 | 21 |
|
| 22 | +Use a banner when you need to communicate a change, error, or important notification within an application. |
| 23 | + |
| 24 | +**Avoid banners for:** |
9 | 25 |
|
| 26 | +- Temporary success confirmations - use **Snackbar** instead |
| 27 | +- Blocking the user from interacting with the page - use **Dialog** instead |
| 28 | +- Inline form validation messages - use field-level feedback instead |
| 29 | + |
| 30 | +## Structure |
| 31 | + |
| 32 | +Banner is a compound component made up of the following parts: |
| 33 | + |
| 34 | +- **`Banner`** - the root container that sets the tone and role |
| 35 | +- **`Banner.Icon`** (optional) - a supporting icon that reinforces the message tone |
| 36 | +- **`Banner.Message`** (required) - the text content communicating the notification |
| 37 | +- **`Banner.Actions`** (optional) - buttons or links that let the user respond to the banner |
10 | 38 |
|
11 | 39 | ## Guidelines |
12 | 40 |
|
| 41 | +### Tones |
| 42 | + |
| 43 | +Tones communicate the intent or severity of the banner message. Each tone uses a distinct colour scheme - border, background, and icon colour - to visually differentiate the level of urgency. |
| 44 | + |
| 45 | +| Tone | Use Case | |
| 46 | +| ------- | ------------------------------------------------------------- | |
| 47 | +| Info | General information, status updates, or helpful tips | |
| 48 | +| Warning | Caution about potential issues or actions that need attention | |
| 49 | +| Danger | Errors, critical alerts, or destructive consequences | |
| 50 | +| Success | Positive confirmations or successful completions | |
| 51 | + |
| 52 | +<iframe |
| 53 | + class="sb-iframe" |
| 54 | + src="https://storybook.eds.equinor.com/iframe.html?globals=&args=&id=eds-2-0-beta-feedback-banner--all-variants" |
| 55 | + width="100%" |
| 56 | + height="600" |
| 57 | + frameborder="1" |
| 58 | +></iframe> |
| 59 | +
|
| 60 | +[View in Storybook](https://storybook.eds.equinor.com/?path=/story/eds-2-0-beta-feedback-banner--all-variants) |
| 61 | + |
| 62 | +### Actions |
| 63 | + |
| 64 | +Actions allow users to respond directly to the banner message. They can contain buttons or links. |
| 65 | + |
| 66 | +- Action buttons should directly relate to the banner's message and clearly represent the intended action |
| 67 | +- Actions can be placed **inline** (beside the text) when space allows, or **stacked** (below the text) when the message is longer |
| 68 | + |
| 69 | +<iframe |
| 70 | + class="sb-iframe" |
| 71 | + src="https://storybook.eds.equinor.com/iframe.html?globals=&args=&id=eds-2-0-beta-feedback-banner--with-actions" |
| 72 | + width="100%" |
| 73 | + height="128" |
| 74 | + frameborder="1" |
| 75 | +></iframe> |
| 76 | +
|
| 77 | +[View in Storybook](https://storybook.eds.equinor.com/?path=/story/eds-2-0-beta-feedback-banner--with-actions) |
| 78 | + |
| 79 | +**Stacked actions** |
| 80 | + |
| 81 | +Use `placement="bottom"` on `Banner.Actions` when the message is long and action buttons need more room. |
| 82 | + |
| 83 | +<iframe |
| 84 | + class="sb-iframe" |
| 85 | + src="https://storybook.eds.equinor.com/iframe.html?globals=&args=&id=eds-2-0-beta-feedback-banner--actions-bottom" |
| 86 | + width="100%" |
| 87 | + height="160" |
| 88 | + frameborder="1" |
| 89 | +></iframe> |
| 90 | +
|
| 91 | +[View in Storybook](https://storybook.eds.equinor.com/?path=/story/eds-2-0-beta-feedback-banner--actions-bottom) |
| 92 | + |
| 93 | +**Links as actions** |
| 94 | + |
| 95 | +Banners can also use links as actions for navigating to more information. |
| 96 | + |
| 97 | +<iframe |
| 98 | + class="sb-iframe" |
| 99 | + src="https://storybook.eds.equinor.com/iframe.html?globals=&args=&id=eds-2-0-beta-feedback-banner--with-link" |
| 100 | + width="100%" |
| 101 | + height="128" |
| 102 | + frameborder="1" |
| 103 | +></iframe> |
| 104 | +
|
| 105 | +[View in Storybook](https://storybook.eds.equinor.com/?path=/story/eds-2-0-beta-feedback-banner--with-link) |
| 106 | + |
| 107 | +### Dismissible |
| 108 | + |
| 109 | +When the `onDismiss` callback is provided, a close button is rendered in the top-right corner. Use this when the user should be able to acknowledge and remove the banner. |
| 110 | + |
| 111 | +<iframe |
| 112 | + class="sb-iframe" |
| 113 | + src="https://storybook.eds.equinor.com/iframe.html?globals=&args=&id=eds-2-0-beta-feedback-banner--dismissible" |
| 114 | + width="100%" |
| 115 | + height="128" |
| 116 | + frameborder="1" |
| 117 | +></iframe> |
| 118 | +
|
| 119 | +[View in Storybook](https://storybook.eds.equinor.com/?path=/story/eds-2-0-beta-feedback-banner--dismissible) |
13 | 120 |
|
14 | 121 | ## Accessibility |
15 | 122 |
|
| 123 | +- Banners use `role="status"` by default, which politely announces content to screen readers |
| 124 | +- For urgent messages that require immediate attention, set `role="alert"` to interrupt the screen reader |
| 125 | +- Ensure banner messages are concise and clearly describe the situation |
| 126 | +- Action buttons and links must have descriptive labels that explain what will happen when activated |
| 127 | +- Avoid relying on colour alone to convey meaning - always pair tone colours with an icon or clear text |
16 | 128 |
|
17 | 129 | ## Figma |
18 | 130 |
|
| 131 | +### Components |
| 132 | + |
| 133 | +- **Banner [EDS]** - the banner component with configurable tone, layout, icon, action, and dismiss options |
| 134 | + |
| 135 | +### Using the Banner in Figma |
| 136 | + |
| 137 | +1. In Figma, go to the **Assets Panel** and search for **Banner** |
| 138 | +2. Drag the component into your frame |
| 139 | +3. Select the component to see its properties in the **Design Panel** |
| 140 | + |
| 141 | +### Property Structure |
19 | 142 |
|
| 143 | +- **Tone** - set the tone (Info, Warning, Danger, or Success) to control the colour scheme |
| 144 | +- **Actions** - choose between None, Buttons, or Link |
| 145 | +- **Layout** - choose between Inline (actions beside text) or Stacked (actions below text) |
| 146 | +- **Dismiss** - toggle the dismiss close button on or off |
| 147 | +- **Icon** - toggle the leading icon on or off |
20 | 148 |
|
21 | | -### Do's and don'ts |
| 149 | +## Do's and Don'ts |
22 | 150 |
|
23 | 151 | :::info **Do** |
24 | 152 |
|
25 | | -- |
26 | | -::: |
| 153 | +- Keep banner messages brief and actionable |
| 154 | +- Use tones consistently to communicate the right level of urgency |
| 155 | +- Show only one banner at a time per context |
| 156 | +- Label action buttons with clear, descriptive text |
| 157 | +- Pair tone colours with icons for better clarity |
| 158 | +- Use `role="alert"` for urgent messages that need immediate attention |
| 159 | + ::: |
27 | 160 |
|
28 | 161 | :::danger **Don't** |
29 | 162 |
|
30 | | -- |
31 | | -::: |
| 163 | +- Stack multiple banners on top of each other |
| 164 | +- Use banners for messages that don't require user awareness or action |
| 165 | +- Rely on colour alone to communicate meaning - pair with icons and clear text |
| 166 | +- Use icon-only action buttons inside banners - always use text labels |
| 167 | +- Leave banners visible indefinitely if the situation has been resolved |
| 168 | + ::: |
0 commit comments