Skip to content

Commit c3f3cbe

Browse files
chore(buttons): update guidelines content (#4484)
* chore(buttons) guidelines images removed modal exception because we standardized this. * chore(buttons):Docs change to guidelines Added semantic spacer info and changed two images * Update button.md typo fix * fix(buttons): update images * Update button.md image too small * Update packages/documentation-site/patternfly-docs/content/design-guidelines/components/button/button.md Co-authored-by: Erin Donehoo <105813956+edonehoo@users.noreply.github.com> * fix(buttons): image update * chore(button): docs changes * chore(motion): update github link * fix(buttons): image tag wrapper and stylesheet * chore(buttons): image tag missing tag --------- Co-authored-by: Erin Donehoo <105813956+edonehoo@users.noreply.github.com>
1 parent a0323db commit c3f3cbe

27 files changed

+86
-39
lines changed

packages/documentation-site/patternfly-docs/content/design-guidelines/components/button/button.md

+85-38
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,26 @@ id: Button
33
section: components
44
---
55

6+
import '../components.css';
7+
68
## Usage
9+
710
There are certain cases where specific buttons must be used within your UI.
811

912
Follow these guidelines for buttons in wizards (shown in the image below):
13+
1014
* The **Next** button should always be a [primary button](#primary-button).
1115
* The **Back** button should always be a [secondary button](#secondary-button).
1216
* The **Cancel** button should always be a [link button](#link-button).
1317

14-
<img src="./img/wizard.png" alt="Example of buttons in a wizard"/>
18+
<div class="ws-docs-content-img">
19+
<img src="./img/wizard.png" alt="Example of buttons in a wizard"/>
20+
</div>
1521

1622
## Variations
23+
1724
The following button styles, shown in order of visual hierarchy, can be used in your designs according to your needs.
25+
1826
* [Danger button](#danger-button)
1927
* [Primary button](#primary-button)
2028
* [Secondary button](#secondary-button)
@@ -24,7 +32,9 @@ The following button styles, shown in order of visual hierarchy, can be used in
2432
* [Call To Action button](#call-to-action-button)
2533
* [Progress button](#progress-button)
2634

27-
<img src="./img/buttons.png" alt="Images of all button types" width="607"/>
35+
<div class="ws-docs-content-img">
36+
<img src="./img/buttons.png" alt="Images of all button types" width="607"/>
37+
</div>
2838

2939
You don't need to use these buttons in the order that their labels imply. For example, you don't always need to use the secondary button as the second button in your designs. The most important thing is to establish a visual hierarchy between any buttons in your designs. There are, however, some best practices to keep in mind.
3040

@@ -34,27 +44,35 @@ Danger buttons are the most prominent of all the button options. Use danger butt
3444

3545
_Example of a danger button in a modal_
3646

37-
<img src="./img/danger.png" alt="Example of danger button used in a modal" width="521"/>
47+
<div class="ws-docs-content-img">
48+
<img src="./img/danger.png" alt="Example of danger button used in a modal" width="521"/>
49+
</div>
3850

3951
### Primary button ###
4052

4153
A primary button is the most prominent button on a page, used for the most important call to action on a page. Try to limit primary buttons to one per page.
4254

4355
_Example of a primary button inside a toolbar_
4456

45-
<img src="./img/prim_ex_1.png" alt="Example of a primary button inside a toolbar" width="1159"/>
57+
<div class="ws-docs-content-img">
58+
<img src="./img/prim_ex_1.png" alt="Example of a primary button inside a toolbar" width="1159"/>
59+
</div>
4660

4761
_Example of a primary button inside an empty state_
4862

49-
<img src="./img/prim_ex_2.png" alt="Example of a primary button inside an empty state" width="656"/>
63+
<div class="ws-docs-content-img">
64+
<img src="./img/prim_ex_2.png" alt="Example of a primary button inside an empty state" width="656"/>
65+
</div>
5066

5167
### Secondary button ###
5268

5369
Secondary buttons are buttons with less visual prominence than primary buttons. Use secondary buttons for general actions on a page, that don’t require as much emphasis as primary button actions. For example, you can use secondary buttons where there are multiple actions, like in toolbars or data lists.
5470

5571
_Example of secondary buttons in data lists_
5672

57-
<img src="./img/sec_ex.png" alt="Example of secondary buttons in data lists" />
73+
<div class="ws-docs-content-img">
74+
<img src="./img/sec_ex.png" alt="Example of secondary buttons in data lists" />
75+
</div>
5876

5977
### Tertiary button ###
6078

@@ -64,70 +82,89 @@ In this example, you can see a tertiary button used to show a possible “Edit
6482

6583
_Example of tertiary button on a page_
6684

67-
<img src="./img/tert_edit.png" alt="Example of tertiary button on a page" width="1500" />
85+
<div class="ws-docs-content-img">
86+
<img src="./img/tert_edit.png" alt="Example of tertiary button on a page" width="1500" />
87+
</div>
6888

6989
### Link button ###
7090

7191
Links buttons are labeled buttons with no background or border. Link buttons can be used for actions that:
92+
7293
* May not need as much emphasis.
7394
* Navigate users to another page within the same window.
7495
* Navigate users to an external page.
7596

7697
While all link buttons lack borders, they can still vary in appearance. Link buttons that navigate users to another page within the same window should be presented as stand-alone text. Link buttons that navigate users to an external page may include an icon on the left or right of the text to further emphasize the action. For example, you could add an external link icon to show that clicking on it will navigate users externally to another website or application.
7798

78-
<img src="./img/link-left.png" alt="Example of link button with icon on the left" width="143"/>
79-
80-
<img src="./img/link-right.png" alt="Example of link button with icon on the right" width="143"/>
99+
<div class="ws-docs-content-img">
100+
<img src="./img/external_links.png" alt="Example of link button with icon on the left and the right" width="218"/>
101+
</div>
81102

82103
You might use a link button instead of a secondary button format to create greater visual hierarchy between two buttons. Examples include using text buttons as cancel buttons in modals or wizards, as well as for secondary actions in empty states.
83104

84105
_Example of a link button in a modal_
85106

86-
<img src="./img/link_modal.png" alt="Example of a link button in a modal" width="446"/>
107+
<div class="ws-docs-content-img">
108+
<img src="./img/link_modal.png" alt="Example of a link button in a modal" width="446"/>
109+
</div>
87110

88111
_Example of link buttons in an empty state_
89112

90-
<img src="./img/empty_state_links.png" alt="Example of link buttons in an empty state" width="640"/>
113+
<div class="ws-docs-content-img">
114+
<img src="./img/empty_state_links.png" alt="Example of link buttons in an empty state" width="640"/>
115+
</div>
91116

92-
### When to use
117+
### When to use
93118

94119
Always use link buttons in the following cases:
95120

96121
* For cancel buttons in wizards or modals
97122

123+
<div class="ws-docs-content-img">
98124
<img src="./img/link_modal.png" alt="Example of link button used in modal" width="446"/>
125+
</div>
99126

100127
* For more actions in empty states
101128

129+
<div class="ws-docs-content-img">
102130
<img src="./img/link_empty.png" alt="Example of a link button in an empty state" width="600"/>
131+
</div>
103132

104133
* For action buttons in tables
105134

135+
<div class="ws-docs-content-img">
106136
<img src="./img/link_table.png" alt="Example of link buttons in a table"/>
137+
</div>
107138

108139
* For action buttons in alerts
109140

141+
<div class="ws-docs-content-img">
110142
<img src="./img/link_alert.png" alt="Example of link button in an alert" width="309"/>
143+
</div>
111144

112145
### Icon button ###
113146

114147
Icon buttons are useful in places where space is limited. For example, if you have too many actions within a menu, you could use a kebab icon to indicate more actions, or an export icon for exporting data. You can also use this button type for actions that are commonly associated with icons, like an exit icon to close a window or a hamburger icon to open a menu.
115148

116149
For example, this toolbar uses a kebab icon as an action button due to limited space.
117150

118-
<img src="./img/icon_button.png" alt="Example of kebab used as an icon button inside a toolbar" width="1159"/>
151+
<div class="ws-docs-content-img">
152+
<img src="./img/icon_button.png" alt="Example of kebab used as an icon button inside a toolbar" width="1159"/>
153+
</div>
119154

120155
### Call To Action button ###
121156

122157
Call To Action (CTA) buttons and links are used on websites to direct users to complete an action. For example, a product detail page could include a CTA button labeled 'Try it now,' which would guide users to a purchase page.
123158

124-
<img src="./img/CTAs.png" alt="Images of all CTA types" width="708"/>
159+
<div class="ws-docs-content-img">
160+
<img src="./img/CTAs.png" alt="Images of all CTA types" width="708"/>
161+
</div>
125162

126163
Call To Actions have similar variants to regular buttons (although they have a larger padding), and follow the same visual hierarchy. However, CTA buttons are used only to indicate a desired next step, whereas other button types may also be used to link to additional information or actions. Call To Actions should be used sparingly (ideally one per page, or a primary and secondary CTA).
127164

128165
### Progress button ###
129166

130-
A progress button can be used to provide the user with feedback that an action is in progress after the button is clicked. To indicate that an action is taking place, a spinner is inserted in front of the button label.
167+
A progress button can be used to provide the user with feedback that an action is in progress after the button is clicked. To indicate that an action is taking place, a spinner is inserted in front of the button label.
131168

132169
**When to use a progress button**
133170

@@ -139,7 +176,9 @@ Do not use a progress button for operations that will take more than a few secon
139176

140177
_Example of using a progress button to test a repository before final configuration_
141178

142-
<img src="./img/progress_bar_stages.png" alt="Example of progress button usage" width="1828"/>
179+
<div class="ws-docs-content-img">
180+
<img src="./img/progress_bar_stages.png" alt="Example of progress button usage" width="1828"/>
181+
</div>
143182

144183
1. The user clicks “try sample repository".
145184

@@ -171,69 +210,77 @@ The placement of buttons on wizards will depend on the layout of content you pre
171210

172211
### Button spacing and action lists
173212

174-
The standard spacing between each button is 16px, even for danger buttons. If buttons are stacked vertically, the spacing between each button should be 8px.
213+
The standard spacing between each button is `--pf-t--global--spacer--md` (16px), even for danger buttons. If buttons are stacked vertically, the spacing between each button should be `--pf-t--global--spacer--sm` (8px).
175214

176215
_Standard spacing_
177216

178-
<img src="./img/button_16px.png" alt="Standard button spacing with spacers" width="214"/>
217+
<div class="ws-docs-content-img">
218+
<img src="./img/button_16px.png" alt="Standard button spacing with spacers" width="214"/>
219+
</div>
179220

180221
_Stacked spacing_
181222

182-
<img src="./img/button_stacked.png" alt="Stacked button spacing with spacers" width="222"/>
223+
<div class="ws-docs-content-img">
224+
<img src="./img/button_stacked.png" alt="Stacked button spacing with spacers" width="222"/>
225+
</div>
183226

184227
### Exceptions ###
185228

186229
Exceptions to the standard spacing guidelines are as follows:
187230

188231
#### Wizards ####
189232

190-
In wizards, the **Cancel** button is spaced 48px away from the primary and secondary **Next** and **Back** buttons, and 24px away if stacked.
233+
In wizards, the **Cancel** button is spaced `--pf-t--global--spacer--2xl` (48px) away from the primary and secondary **Next** and **Back** buttons, and `--pf-t--global--spacer--lg` (24px) away if stacked.
191234

192235
_Wizard spacing_
193236

194-
<img src="./img/button_wizard.png" alt="Wizard button spacing with spacers" width="304"/>
195-
237+
<div class="ws-docs-content-img">
238+
<img src="./img/button_wizard.png" alt="Wizard button spacing with spacers" width="304"/>
239+
</div>
196240
_Wizard stacked spacing_
197241

198-
<img src="./img/button_wizard_stacked.png" alt="Stacked wizard button spacing with spacers" width="121"/>
199-
200-
#### Modals ####
201-
202-
In modals, the primary button is spaced only 8px away from the secondary button, rather than the standard 16px.
203-
204-
_Modal spacing_
205-
206-
<img src="./img/modal_exception.png" alt="Modal button spacing with spacers" width="446"/>
242+
<div class="ws-docs-content-img">
243+
<img src="./img/button_wizard_stacked.png" alt="Stacked wizard button spacing with spacers" width="360"/>
244+
</div>
207245

208246
#### Toolbars ####
209247

210-
Button spacing in toolbars depends on the button type. Normal 16px spacing applies between primary and secondary buttons. However, there should only be 8px between icon buttons.
248+
Button spacing in toolbars depends on the button type and how they are grouped. For example, groups of primary and secondary buttons use `--pf-t--global--spacer--sm` (8px) spacing between buttons and `--pf-t--global--spacer--md` (16px) between groups. Icon buttons inside a grouping use `--pf-t--global--spacer--xs` (4px) spacing and `--pf-t--global--spacer--md` (16px) between groups.
211249

212250
_Toolbar spacing_
213251

214-
<img src="./img/toolbar_exception.png" alt="Toolbar button spacing with spacers" width="312"/>
252+
<div class="ws-docs-content-img">
253+
<img src="./img/toolbar_exception.png" alt="Toolbar button spacing with spacers" width="312"/>
254+
</div>
215255

216256
If you have a specific use case where buttons need to be spaced further away from the rest, the button groups action list allows for customization as needed.
217257

218258
_Action group spacing_
219259

220-
<img src="./img/button_action_group.png" alt="Action group spacing with spacers" width="416"/>
260+
<div class="ws-docs-content-img">
261+
<img src="./img/button_action_group.png" alt="Action group spacing with spacers" width="416"/>
262+
</div>
221263

222264
### Buttons and overflow menus
223265

224266
There are cases where you will have multiple buttons next to each other, like in a toolbar. When the space shrinks (e.g., switching from desktop to mobile view), you can have the buttons collapse into a kebab overflow menu. Additionally, you can choose to make the primary action persist or have all options collapse into the kebab.
225267

226268
_Buttons appear in the toolbar_
227269

228-
<img src="./img/overflow_1.png" alt="Pre-over flow menu in toolbar, where all actions appear in the toolbar itself" width="1191"/>
270+
<div class="ws-docs-content-img">
271+
<img src="./img/overflow_1.png" alt="Pre-over flow menu in toolbar, where all actions appear in the toolbar itself" width="1191"/>
272+
</div>
229273

230274
_Buttons placed in overflow menu due to limited space, with primary button persisting_
231275

232-
<img src="./img/overflow_2.png" alt="Post-overflow menu in toolbar, where toolbar has become smaller in width, prompting an overflow menu for secondary actions, while primary button persists in the toolbar itself" width="1010"/>
276+
<div class="ws-docs-content-img">
277+
<img src="./img/overflow_2.png" alt="Post-overflow menu in toolbar, where toolbar has become smaller in width, prompting an overflow menu for secondary actions, while primary button persists in the toolbar itself" width="1010"/>
278+
</div>
233279

234280
## Placement
235281

236282
Buttons in forms, modals, or wizards should always be left aligned in the box. This solves for:
283+
237284
* **Modularity and flexibility:** A standard alignment creates consistency in how objects appear across all areas of an app.
238285
* **Accessibility:** The form submit buttons are on the same scan line as the form fields, which benefits users who are sight-limited. Also, users who are blind can more easily navigate left-aligned form submit buttons because the button order is consistent across all contexts.
239286
* **Responsiveness:** The most important actions (i.e., primary buttons) are encountered first when elements are stacked vertically.
@@ -257,6 +304,6 @@ When writing button labels:
257304

258305
Use specific, action-focused labels that match what the user will see when they arrive at their location. For example, if you are sending a user to a dashboard, your link label might read _View dashboard_. For a link directing a user to a support forum, the label might read _Get help in the support forum_. See [PatternFly's content guidelines](/ux-writing/about-ux-writing) for additional guidance.
259306

260-
## Accessibility
307+
## Accessibility
261308

262309
For information regarding accessibility, visit the [button accessibility page](/components/button/accessibility).

packages/documentation-site/patternfly-docs/content/design-guidelines/styles/motion/motion.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import ExternalLinkAltIcon from '@patternfly/react-icons/dist/esm/icons/external
1010
variant="info"
1111
title="Under development"
1212
actionLinks={
13-
<AlertActionLink component="a" href="https://github.com/orgs/patternfly/projects/16/views/18">
13+
<AlertActionLink component="a" href="https://github.com/orgs/patternfly/projects/7/views/66">
1414
View the project roadmap <ExternalLinkAltIcon />
1515
</AlertActionLink>
1616
}

0 commit comments

Comments
 (0)