Skip to content

Commit 200baeb

Browse files
feat(docs): update Callout and Alert guidelines (#4062)
* feat(docs): update Callout with dismissible guidelines * feat(docs): update notifications and feedback pattern * feat(docs): update Page Header Alert guidelines * feat(docs): update Alert placement guidelines and cleanup * feat(docs): update Alert image in notifications pattern * chore: typo on Notifications pattern * chore(Notification pattern): fix typos * chore: typo on Alert * feat: update pattern images and PR comments * fix(notification docs): Add Stack to ingredients list --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent 337587d commit 200baeb

File tree

6 files changed

+93
-148
lines changed

6 files changed

+93
-148
lines changed
394 KB
Loading
94.7 KB
Loading

packages/paste-website/src/pages/components/alert/index.mdx

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const getStaticProps = async () => {
4646

4747
<LivePreview scope={{Alert, Text}} language="jsx">
4848
{`<Alert variant="warning">
49-
<strong>Chimamanda Ngozi Adichie:</strong> Racism should never have happened and so you don't get a cookie for reducing it.
49+
<strong>Some information on this page may be out-of-date.</strong> This page was last updated at 9:00 a.m. PST. We're currently looking into this issue.
5050
</Alert>`}
5151
</LivePreview>
5252

@@ -73,9 +73,9 @@ Use an Alert for one of these types of information:
7373

7474
### Accessibility
7575

76-
- Pass in `role="alert"` or `role="status"` through [props](#props). Otherwise, the default role is `status` for neutral alerts and `alert` for warning and error alerts.
77-
- Screen readers announce error and warning alert text immediately. Alerts that persist across multiple pages announce themselves repeatedly which may become annoying. Consider making alerts in these cases dismissible.
78-
- Show an alert only when it's needed. Assistive technologies will be able to read a visually hidden element. Don't visually hide an alert and then make it visible through client-side code.
76+
- Pass in `role="alert"` or `role="status"` through [props](#props). Otherwise, the default role is `status` for neutral Alerts and `alert` for warning and error Alerts.
77+
- Screen readers announce error and warning Alert text immediately. Alerts that persist across multiple pages announce themselves repeatedly which may become annoying. Consider making Alerts in these cases dismissible.
78+
- Show an Alert only when it's needed. Assistive technologies will be able to read a visually hidden element. Don't visually hide an Alert and then make it visible through client-side code.
7979

8080
Alert uses multiple methods to indicate type.
8181

@@ -86,24 +86,22 @@ Alert uses multiple methods to indicate type.
8686

8787
<Box marginBottom="space30">
8888
<Alert variant="neutral">
89-
<strong>Martin Luther King, Jr.:</strong> We may have all come on different ships, but we’re in the same boat now.
89+
<strong>Set up your contact preferences.</strong> You can now set up your contact preferences on your dashboard. <Anchor href="#">Go to contact preferences</Anchor>
9090
</Alert>
9191
</Box>
9292
<Box marginBottom="space30">
9393
<Alert variant="warning">
94-
<strong>James Baldwin:</strong> Love takes off masks that we fear we cannot live without and know we cannot live
95-
within.
94+
<strong>Some information on this page may be out-of-date.</strong> This page was last updated at 9:00 a.m. PST. We're currently looking into this issue.
9695
</Alert>
9796
</Box>
9897
<Box marginBottom="space30">
9998
<Alert variant="error">
100-
<strong>Audre Lorde:</strong> It is not our differences that divide us. It is our inability to recognize, accept,
101-
and celebrate those differences.
99+
<strong>Please update your billing information or we'll suspend your account on March 2.</strong> We couldn't renew your subscription with the information we currently have. <Anchor href="#">Update billing information</Anchor>
102100
</Alert>
103101
</Box>
104102
<Box marginBottom="space70">
105-
<Alert onDismiss={() => alert('dismissed')} variant="warning">
106-
<strong>Toni Morrison:</strong> You wanna fly, you got to give up the shit that weighs you down.
103+
<Alert onDismiss={() => alert('dismissed')} variant="neutral">
104+
<strong>Set up your contact preferences.</strong> You can now set up your contact preferences on your dashboard. <Anchor href="#">Go to contact preferences</Anchor>
107105
</Alert>
108106
</Box>
109107

@@ -113,7 +111,7 @@ Use a neutral Alert to notify a user of a change that's relevant for them to ach
113111

114112
In most cases, a neutral Alert should be dismissible (_i.e._, have a close button) and should be assigned `role="status"`.
115113

116-
You may use [the Text primitive](/primitives/text) as a child of Alert, but if you do, be sure to pass `color="inherit"` for neutral alerts.
114+
You may use the [Text primitive](/primitives/text) as a child of Alert, but if you do, be sure to pass `color="inherit"` for neutral Alerts.
117115

118116
<LivePreview scope={{Alert, Text, Anchor}} language="jsx">
119117
{`<Alert variant="neutral">
@@ -129,23 +127,23 @@ A warning Alert should provide explain the possible issue, what to do, and what
129127

130128
Be cautious about using a warning Alert because they can be stressful for a user to see. In most cases, a warning Alert should be assigned `role="alert"`.
131129

132-
You may use [the Text primitive](/primitives/text) as a child of Alert, but if you do, be sure to pass `color="inherit"` for warning alerts.
130+
You may use the [Text primitive](/primitives/text) as a child of Alert, but if you do, be sure to pass `color="inherit"` for warning Alerts.
133131

134132
<LivePreview scope={{Alert, Text}} language="jsx">
135133
{`<Alert variant="warning">
136-
<strong>Some information on this page may be out-of-date.</strong> This page was last updated at 9:00 AM PST. We're currently looking into this issue.
134+
<strong>Some information on this page may be out-of-date.</strong> This page was last updated at 9:00 a.m. PST. We're currently looking into this issue.
137135
</Alert>`}
138136
</LivePreview>
139137

140138
### Error
141139

142-
Use an error Alert to help a user understand a critical issue at the system level, like site-wide service disruptions, active incidents, or expired billing information. When possible, provide a way to resolve the issue in the alert.
140+
Use an error Alert to help a user understand a critical issue at the system level, like site-wide service disruptions, active incidents, or expired billing information. When possible, provide a way to resolve the issue in the Alert.
143141

144142
In most cases, error Alerts should be assigned `role="alert"`.
145143

146144
For additional guidance on what kind of component to use, use the [Alert vs. Callout vs. Toast vs. Help Text guide](#alert-vs-callout-vs-toast-vs-help-text). For additional guidance on how to compose error messages, refer to the [error state pattern](/patterns/error-state).
147145

148-
You may use [the Text primitive](/primitives/text) as a child of Alert, but if you do, be sure to pass `color="inherit"` for error alerts.
146+
You may use the [Text primitive](/primitives/text) as a child of Alert, but if you do, be sure to pass `color="inherit"` for error Alerts.
149147

150148
<LivePreview scope={{Alert, Text, Anchor}} language="jsx">
151149
{`<Alert variant="error">
@@ -155,15 +153,15 @@ You may use [the Text primitive](/primitives/text) as a child of Alert, but if y
155153

156154
### Dismissible
157155

158-
Add a close button to the alert if it doesn't communicate a persistent status of the system or the account. If you make an alert dismissible, provide another way for the user to retrieve the alert information.
156+
Make the Alert dismissible if it doesn't communicate a persistent status of the system or the account. If you make an Alert dismissible, provide another way for the user to retrieve the alert information.
159157

160-
Don't add a close button to the alert if all these conditions are true:
158+
Don't make it dismissible if all these conditions are true:
161159

162-
- The alert communicates a persistent status of the system or the account.
163-
- The information is relevant to the user's goals on the page(s) the alert is on.
164-
- The user wouldn't be able to access the information in the alert if it were closed.
160+
- The Alert communicates a persistent status of the system or the account.
161+
- The information is relevant to the user's goals on the page(s) the Alert is on.
162+
- The user wouldn't be able to access the information in the Alert if it were closed.
165163

166-
Keep in mind that the longer an alert is present, the more it starts looking like part of the page and loses its interruptive intent. This might make users start to ignore important alert information.
164+
Keep in mind that the longer an Alert is present, the more it starts looking like part of the page and loses its interruptive intent. This might make users start to ignore important Alert information.
167165

168166
<LivePreview scope={{Alert, Text, Anchor}} language="jsx">
169167
{`<Alert onDismiss={() => alert('dismissed')} variant="neutral">
@@ -187,7 +185,7 @@ For an `error` variant, for example, set the `i18nErrorLabel` prop.
187185

188186
## Composition notes
189187

190-
Keep content brief by placing only the highest priority information in an Alert. A good rule of thumb is to keep text to a single line in a desktop-sized container, or [limit it to 90 characters](https://practicaltypography.com/responsive-web-design.html).
188+
Keep content brief by placing only the highest priority information in an Alert. Generally try to [limit content to 90 characters](https://practicaltypography.com/responsive-web-design.html).
191189

192190
Compose an Alert with:
193191

@@ -213,7 +211,7 @@ Alert
213211
[Toast](/components/toast)
214212

215213
- Toasts communicate brief, easily comprehended messages.
216-
- Toasts generally result from a user action.
214+
- Toasts result from a user action.
217215
- If the message is contextual or specific to a particular part of a page, consider Help Text or a Callout.
218216
- Do not use a Toast if the message is longer than two sentences (~140 characters). Use a Callout instead.
219217
- Do not use a Toast if there is more than one anchor or button. Use a Callout instead.
@@ -234,13 +232,13 @@ In general, the persistence and behavior on scroll of an Alert should match the
234232
<DoDont>
235233
<Do
236234
title="Do"
237-
body="Use only one Alert per page. Use two Alerts only if absolutely necessary and if the Alerts are placed in different containers. Be sure to add 0.5rem spacing if using two Alerts."
235+
body="Use only 1 Alert per page. Use 2 Alerts only if absolutely necessary and if the Alerts are placed in different containers. Add space30 spacing if using 2 Alerts."
238236
>
239237
<Alert variant="error">
240-
Your account balance is low and your credit card has expired. As a result we have suspended your account
238+
Your account balance is low and your credit card has expired. As a result, we have suspended your account.
241239
</Alert>
242240
</Do>
243-
<Dont title="Don't" body="Don't use more than two Alerts per page.">
241+
<Dont title="Don't" body="Don't use more than 2 Alerts per page.">
244242
<Alert variant="error">Your credit card has expired</Alert>
245243
<Alert variant="warning">Your account balance is low</Alert>
246244
<Alert variant="error">Your account is suspended</Alert>
@@ -250,16 +248,16 @@ In general, the persistence and behavior on scroll of an Alert should match the
250248
<DoDont>
251249
<Do
252250
title="Do"
253-
body="Place global Alerts at the top of the page. Place all other Alerts at the top of the container it relates to beneath the heading."
251+
body="Place global or page-level Alerts at the top of the page. Place all other Alerts at the top of the container it relates to."
254252
>
255253
<Box padding="space40">
256254
<Card>
257-
<Heading as="h2" variant="heading20">
258-
Section Heading
259-
</Heading>
260255
<Box marginBottom="space70">
261256
<Alert variant="error">There was a problem below</Alert>
262257
</Box>
258+
<Heading as="h2" variant="heading20">
259+
Section Heading
260+
</Heading>
263261
<Paragraph>Please fill in the details below...</Paragraph>
264262
</Card>
265263
</Box>
@@ -279,13 +277,13 @@ In general, the persistence and behavior on scroll of an Alert should match the
279277
<DoDont>
280278
<Do
281279
title="Do"
282-
body="Use anchors to link to more information that may be helpful for users to resolve or clarify an Alert message."
280+
body="Use Anchors to link to more information that may be helpful for users to resolve or clarify an Alert message."
283281
>
284282
<Alert variant="neutral">
285283
A call to action <Anchor href="#">Learn more</Anchor>
286284
</Alert>
287285
</Do>
288-
<Dont title="Don't" body="Avoid using buttons in Alerts unless it triggers an action.">
286+
<Dont title="Don't" body="Avoid using Buttons in Alerts unless it triggers an action.">
289287
<Alert variant="neutral">
290288
A call to action{' '}
291289
<Button size="small" variant="primary">

packages/paste-website/src/pages/components/callout/index.mdx

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -47,41 +47,43 @@ export const getStaticProps = async () => {
4747

4848
### About Callout
4949

50-
Use a Callout to highlight important information on a page or in a page section. Callouts can result from user action, but don’t have to. Do not use a Callouts to tell users about a system-level issue; use an [Alert](/components/alert) instead. Do not use a Callout to convey brief, low-complexity information; use a [Toast](/components/toast) instead. For additional guidance on what kind of component to use, use the [Alert vs. Callout vs. Toast vs. Help Text guide](#alert-vs-callout-vs-toast-vs-help-text).
50+
Use a Callout to highlight important information on a page. Callouts are less restrictive than Alerts or Toasts—they can result from user action, but don’t have to.
51+
52+
Do not use a Callout to tell users about a system-level issue; use an [Alert](/components/alert) instead. For additional guidance on what kind of component to use, reference the [Alert vs. Callout vs. Toast vs. Help Text guide](#alert-vs-callout-vs-toast-vs-help-text).
5153

5254
### Accessibility
5355

54-
We recommend Callouts have a CalloutHeading so that the information is easier to navigate to for people who use screen readers. The CalloutHeading's level should be set appropriately with the `as` prop. It is important to not skip one or more heading levels as it is common for screen readers to build an outline of the page and assist users as they navigate a page.
56+
Callouts should have a `CalloutHeading` so that the information is easier to navigate to for people who use screen readers. The `CalloutHeading`'s level should be set appropriately with the `as` prop. It is important to not skip one or more heading levels as it is common for screen readers to build an outline of the page and assist users as they navigate a page.
5557

5658
## Examples
5759

5860
There are five variants of Callouts: `neutral`, `success`, `warning`, `error`, and `new`. Each variant includes an icon.
5961

60-
Each variant includes an icon. To internationalize the icon label for a variant, simply pass the `i18nLabel` prop.
62+
To internationalize the icon label for a variant, pass the `i18nLabel` prop.
6163

6264
### Neutral Callout
6365

64-
Use a neutral Callout to communicate relevant information to the page or flow. The information is often static.
66+
Use a neutral Callout to communicate relevant information to the page or flow. This information is often static.
6567

6668
<LivePreview scope={{ Callout, CalloutHeading, CalloutText }} language="jsx">
6769
{`
6870
<Callout variant='neutral'>
69-
<CalloutHeading as="h2">Neutral Callout</CalloutHeading>
70-
<CalloutText>This is some information you need to know.</CalloutText>
71+
<CalloutHeading as="h2">Finding your category ID</CalloutHeading>
72+
<CalloutText>On your dashboard, look for the relevant "Category ID". It will contain up to five alphanumeric characters.</CalloutText>
7173
</Callout>`}
7274
</LivePreview>
7375

7476
### Success Callout
7577

76-
Use a success Callout to communicate that the desired outcome was achieved. A success Callout can be appropriate when the outcome is relevant to a particular part of the page, or when additional information or context needs to be provided.
78+
Use a success Callout to communicate that the desired outcome was achieved. A success Callout can be appropriate when the outcome is relevant to a specific part of the page, or when additional information or context needs to be provided.
7779

78-
When composing a success Callout, avoid using the word "successfully"it's redundant.
80+
When composing a success Callout, avoid using the word "successfully" since it's redundant.
7981

8082
<LivePreview scope={{ Callout, CalloutHeading, CalloutText }} language="jsx">
8183
{`
8284
<Callout variant='success'>
83-
<CalloutHeading as="h2">Success Callout</CalloutHeading>
84-
<CalloutText>This is some information you need to know.</CalloutText>
85+
<CalloutHeading as="h2">Recommended action</CalloutHeading>
86+
<CalloutText>Make sure you have permission first. Only send messages to mobile users who have provided consent (opted-in) to receive messages from you.</CalloutText>
8587
</Callout>`}
8688
</LivePreview>
8789

@@ -94,8 +96,8 @@ A warning Callout should should explain the possible issue, what to do, and what
9496
<LivePreview scope={{ Callout, CalloutHeading, CalloutText }} language="jsx">
9597
{`
9698
<Callout variant='warning'>
97-
<CalloutHeading as="h2">Warning Callout</CalloutHeading>
98-
<CalloutText>This is some information you need to know.</CalloutText>
99+
<CalloutHeading as="h2">Permission settings will change in 30 days.</CalloutHeading>
100+
<CalloutText>Update your permission settings now to avoid any delays or issues accessing your accounts.</CalloutText>
99101
</Callout>`}
100102
</LivePreview>
101103

@@ -106,8 +108,8 @@ Use an error Callout to communicate errors for a particular section of a page, o
106108
<LivePreview scope={{ Callout, CalloutHeading, CalloutText }} language="jsx">
107109
{`
108110
<Callout variant='error'>
109-
<CalloutHeading as="h2">Error Callout</CalloutHeading>
110-
<CalloutText>This is some information you need to know.</CalloutText>
111+
<CalloutHeading as="h2">Missing values</CalloutHeading>
112+
<CalloutText>Please fill out the "Street address" field.</CalloutText>
111113
</Callout>`}
112114
</LivePreview>
113115

@@ -118,18 +120,19 @@ Use a new Callout to spotlight a recent addition or update.
118120
<LivePreview scope={{ Callout, CalloutHeading, CalloutText }} language="jsx">
119121
{`
120122
<Callout variant='new'>
121-
<CalloutHeading as="h2">New Callout</CalloutHeading>
122-
<CalloutText>This is some information you need to know.</CalloutText>
123+
<CalloutHeading as="h2">Early access to AI features</CalloutHeading>
124+
<CalloutText>You have early access to deliverability scores, Intelligent Discovery Assistant, and intelligent alerts. Try out these new features, and get personalized alerts and recommendations for your account.</CalloutText>
123125
</Callout>`}
124126
</LivePreview>
125127

126128
### Dismissible Callout
127129

130+
Make a Callout dismissible with the `onDismiss` prop if it doesn't communicate a persistent status of the system or the account, or you provide another way for the user to access the information.
131+
128132
<LivePreview scope={{ Callout, CalloutHeading, CalloutText }} language="jsx">
129133
{`
130134
<Callout variant='new' onDismiss={() => alert("dismissed")}>
131-
<CalloutHeading as="h2">Dismissible Callout</CalloutHeading>
132-
<CalloutText>This callout can be provided an onDismiss prop to allow for dismissible functionality.</CalloutText>
135+
<CalloutText>Changes to conference insights settings apply only to conferences created in the past 30 days.</CalloutText>
133136
</Callout>`}
134137
</LivePreview>
135138

@@ -175,9 +178,9 @@ Callouts can be inline with text, so use the `marginY` prop to add a vertical ma
175178

176179
Compose a Callout with:
177180

178-
- **Title (optional).** The title should be concise and convey the essense of the issue.
179-
- **Body text.** Use the default text style. Do not repeat information contained in a title. If the user needs to take action on another page, or more information would be helpful, include an [Anchor](/components/anchor).
180-
- **Full punctuation.** Use periods after full sentences. Avoid using exclamation points.
181+
- **Heading (optional).** The heading should be concise and convey the essence of the issue.
182+
- **Body text.** Use the default text style. Do not repeat information contained in the heading. If the user needs to take action on another page, or more information would be helpful, include an [Anchor](/components/anchor).
183+
- **Full punctuation.** Use periods after full sentences.
181184

182185
### Alert vs. Callout vs. Toast vs. Help Text
183186

@@ -195,10 +198,10 @@ Callout
195198
Toast
196199

197200
- Toasts communicate brief, easily comprehended messages.
198-
- Toasts generally result from a user action.
201+
- Toasts result from a user action.
199202
- If the message is contextual or specific to a particular part of a page, consider Help Text or a Callout.
200203
- Do not use a Toast if the message is longer than two sentences (~140 characters). Use a Callout instead.
201-
- Do not use a Toast if there is more than one anchor or button. Use a Callout instead.
204+
- Do not use a Toast if there is more than one Anchor or Button. Use a Callout instead.
202205

203206
Help Text
204207

0 commit comments

Comments
 (0)