Skip to content

Commit bd6e28f

Browse files
authored
docs(design-system-docs): add Banner component documentation (#4605)
* docs(design-system-docs): add Banner component documentation Populate the Banner documentation page with guidelines, tones, variants, accessibility, Figma usage, and do's/don'ts. Storybook iframe placeholders are included for when the 2.0 implementation is available. Closes #4450 * docs(design-system-docs): rewrite Banner docs with live Storybook examples and sidebar entry Rewrites Banner documentation to match Button doc structure, adds live Storybook iframes, updates component API to reflect compound component pattern, and adds Feedback category to the sidebar. * fix/changed from 'error' to 'danger' in figma prop structure
1 parent 90bba3a commit bd6e28f

2 files changed

Lines changed: 147 additions & 5 deletions

File tree

apps/design-system-docs/docs/components/feedback/banner.md

Lines changed: 142 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,167 @@
22
title: Banner
33
sidebar_position: 1
44
---
5+
56
# Banner
67

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+
720
## When to Use
821

22+
Use a banner when you need to communicate a change, error, or important notification within an application.
23+
24+
**Avoid banners for:**
925

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
1038

1139
## Guidelines
1240

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)
13120

14121
## Accessibility
15122

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
16128

17129
## Figma
18130

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
19142

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
20148

21-
### Do's and don'ts
149+
## Do's and Don'ts
22150

23151
:::info **Do**
24152

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+
:::
27160

28161
:::danger **Don't**
29162

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+
:::

apps/design-system-docs/sidebars.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ const sidebars: SidebarsConfig = {
7979
'components/data-display/tooltip',
8080
],
8181
},
82+
{
83+
type: 'category',
84+
label: 'Feedback',
85+
items: ['components/feedback/banner'],
86+
},
8287
{
8388
type: 'category',
8489
label: 'Navigation',

0 commit comments

Comments
 (0)