Skip to content

Commit 0f3fa1b

Browse files
update Contributing to Docs on Alert and Expandable components (#12485)
* update guidelines on Alert and Expandable components * Apply suggestions from code review Co-authored-by: Alex Krawiec <[email protected]> --------- Co-authored-by: Alex Krawiec <[email protected]>
1 parent c687791 commit 0f3fa1b

File tree

1 file changed

+82
-35
lines changed

1 file changed

+82
-35
lines changed

docs/contributing/pages/components.mdx

+82-35
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,44 @@ sidebar_order: 40
66

77
## Alert
88

9-
Render an alert callout.
9+
Render an alert (sometimes called a callout) to highlight important information.
1010

11-
<Alert title="Watch out!">
12-
This is an info alert. Use these for information that's critical to know; it's important for users to read, but won't cause a catastrophic problem if they don't read it. These include versions that introduce breaking changes or feature limitations. Use infrequently.
11+
<Alert title="Note">
12+
This is an info alert. Use this to emphasize information that users should
13+
read.
1314
</Alert>
1415

1516
<Alert level="warning" title="Important">
16-
This is a warning alert. Use these for items that MUST be well understood before proceeding. These highlight information that could cause users to make catastrophic errors that break their applications in ways that are very difficult to fix or create liabilities for them, such as information needed to avoid leaking PII. These should be used very rarely.
17+
This is a warning alert. Use this to alert users to potential risks they
18+
should be aware of.
1719
</Alert>
1820

1921
<Alert level="success" title="Tip">
20-
This is a success alert. Use these when.... TODO?
22+
This is a success alert. Use this to provide optional information that can
23+
help users be more successful.
2124
</Alert>
2225

2326
<Alert>
24-
This is an alert without title.
27+
This is an alert without a title. `warning` alerts should always have titles
28+
to emphasize their importance.
2529
</Alert>
2630

2731
<Alert>
28-
This is a multi-line alert without title. Use these for information that's critical to know; it's important for users to read, but won't cause a catastrophic problem if they don't read it. These include versions that introduce breaking changes or feature limitations. Use infrequently.
32+
This is a multi-line alert without a title. Keep information brief and to the
33+
point. If this is challenging, consider whether the topic needs documentation
34+
on another page or if using the [Expandable](#expandable) component would be a
35+
better fit.
2936
</Alert>
3037

3138
<Alert title="List">
32-
<ul>
33-
<li>Item 1</li>
34-
<li>Item 2</li>
35-
</ul>
39+
<ul>
40+
<li>You can create lists</li>
41+
<li>and **format** _your_ `text`</li>
42+
</ul>
3643
</Alert>
3744

38-
3945
```markdown {tabTitle:Info}
40-
<Alert title="Watch out!">
46+
<Alert title="Note">
4147
This is an info alert.
4248
</Alert>
4349
```
@@ -56,27 +62,38 @@ This is a success alert.
5662

5763
```markdown {tabTitle:No Title}
5864
<Alert>
59-
This is an alert without title.
65+
This is an info alert without a title.
6066
</Alert>
6167
```
6268

6369
Attributes:
6470

6571
- `title` (string) - optional
66-
- `level` (string: `'info' | 'warning' | 'success') - optional, defaults to `'info'`
72+
- `level` (string: `'info' | 'warning' | 'success'`) - optional, defaults to `'info'`
73+
**Where to place alerts:**
74+
- Make sure your alerts aren't breaking the flow of the content. For example, don't put an alert in between two paragraphs that explain a single concept. Use alerts sparingly; too many alerts on a single page can be overwhelming.
75+
**When to use which alert level:**
76+
77+
- **Info**: Use this to emphasize information that users should read. For example:
78+
- information needed for users to succeed
79+
- information you'd typically wrap in a note callout
80+
- **Warning**: Use this to alert users to potential risks they should be aware of. For example:
6781

68-
Use this for these types of content:
82+
- warnings about potential errors, such as ones caused by common oversights in project configuration
83+
- warnings regarding breaking changes
6984

70-
- **Important:** Use these for information that's critical to know; it's important for users to read, but won't cause a catastrophic problem if they don't read it. These include versions that introduce breaking changes or feature limitations. Use infrequently.
71-
- Use this with or without a title
72-
- **Warning:** Use these for items that MUST be well understood before proceeding. These highlight information that could cause users to make catastrophic errors that break their applications in ways that are very difficult to fix or create liabilities for them, such as information needed to avoid leaking PII. These should be used very rarely.
73-
- Use with the title "Important"; do not use the title "Warning"
85+
Best practices:
7486

75-
You can also omit the title of the alert.
87+
- always use a title with this alert level
88+
89+
- **Success**: Use this to provide optional information that can help users be more successful. For example:
90+
- information that helps improve an already successful task, such as a link to additional reading material
91+
- tips for best practices
7692

7793
## Arcade embeds
7894

7995
Render an [Arcade](https://arcade.software) embed.
96+
8097
<Arcade src="https://demo.arcade.software/v7uhzmdV6Q5PDzoVPAE6?embed&show_copy_link=true" />
8198
```markdown {tabTitle:Example}
8299
<Arcade src="https://demo.arcade.software/v7uhzmdV6Q5PDzoVPAE6?embed&show_copy_link=true" />
@@ -88,44 +105,74 @@ Attributes:
88105

89106
## Expandable
90107

91-
Render an expandable section.
108+
Render an expandable section to provide additional information to users on demand.
92109

93-
<Expandable title="This is a title">This is some content</Expandable>
110+
<Expandable title="Here's something worth noting">
111+
This is an expandable section in an `'info'` alert style. Use this to provide
112+
additional information that is helpful, but not crucial.
113+
</Expandable>
94114

95-
<Expandable permalink title="With Permalink">This is some content</Expandable>
115+
<Expandable permalink title="With permalink">
116+
This is an expandable section in an `'info'` alert style with a title wrapped
117+
in a link.
118+
</Expandable>
96119

97-
<Expandable title="Warning" level="warning">This is some warning content</Expandable>
120+
<Expandable title="This could be important to some users" level="warning">
121+
This is an expandable section in a `'warning'` alert style. Use this to warn
122+
users about minor potential risks.
123+
</Expandable>
98124

99-
<Expandable title="Success" level="success">This is some success content</Expandable>
125+
<Expandable title="Want some tips to improve something?" level="success">
126+
This is an expandable section in a `'success'` alert style. Use this to
127+
provide optional information that can help users be more successful.
128+
</Expandable>
100129

101130
```markdown {tabTitle:Example}
102-
<Expandable title="This is a title">
103-
This is some content
131+
<Expandable title="Here's something worth noting">
132+
This is an expandable section in an `'info'` alert style.
104133
</Expandable>
105134
```
106135

107136
```markdown {tabTitle:Permalink}
108-
<Expandable permalink title="With Permalink">
109-
This is some content
137+
<Expandable permalink title="With permalink">
138+
This is an expandable section with a permalink.
110139
</Expandable>
111140
```
112141

113142
```markdown {tabTitle:Warning}
114-
<Expandable level="warning" title="This is a title">
115-
This is some content
143+
<Expandable level="warning" title="This could be important to some users">
144+
This is an expandable section in a `'warning'` alert style.
116145
</Expandable>
117146
```
118147

119148
```markdown {tabTitle:Success}
120-
<Expandable level="success" title="This is a title">
121-
This is some content
149+
<Expandable level="success" title="Want some tips to improve something?">
150+
This is an expandable section in a `'success'` alert style.
122151
</Expandable>
123152
```
124153

125154
Attributes:
126155

127156
- `title` (string)
128-
- `permalink` (boolean) - optional: the title as a link and show it in the TOC.
157+
- `permalink` (boolean) - optional: wraps the title in a link and shows it in the table of contents.
158+
159+
**When to use expandables:**
160+
161+
Expandables help keep our documentation clutter-free, allowing users to focus on important information while providing them the option to explore additional relevant details.
162+
163+
For example, use expandables to:
164+
165+
- offer information that is useful to some users but not all, like troubleshooting tips
166+
- provide background information or insights into related concepts
167+
168+
**Best practices**
169+
170+
- Write the expandable title as a question or statement to clarify what users can expect from the content within:
171+
- Do you want to learn more about these features?
172+
- Are you using Node.js version 15 or lower?
173+
- Advanced configuration options for XY use case.
174+
- When you need to share important information that users should read, consider using an [alert](#alert) instead since its content is visible by default.
175+
- Avoid overusing this component and make sure to provide valuable information that is relevant to the current topic.
129176

130177
## Code Blocks
131178

0 commit comments

Comments
 (0)