Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WNMGDS-2864] Add utility actions pattern guidance page #3198

Merged
merged 30 commits into from
Sep 10, 2024
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c565211
Initial file creation and addition of copy
jack-ryan-nava-pbc Aug 8, 2024
1aa6047
Punctuation updates.
jack-ryan-nava-pbc Aug 9, 2024
fd0f3bc
Updating snapshots
jack-ryan-nava-pbc Aug 12, 2024
a2194a2
Revert "Updating snapshots"
jack-ryan-nava-pbc Aug 12, 2024
f7208cf
[WNMGDS-2861] Adds PrintIcon component (#3196)
tamara-corbalt Aug 12, 2024
1480db8
[WNMGDS-2878] Render Doc Site stories for Modal Dialog and Drawer (#3…
jack-ryan-nava-pbc Aug 14, 2024
1525f8f
Added print icon
jack-ryan-nava-pbc Aug 14, 2024
805ed8b
[WNMGDS-2861] Adds Email, Link, RSS & What's New Icon components (#3202)
tamara-corbalt Aug 15, 2024
83f49be
Adding all icons and text
jack-ryan-nava-pbc Aug 15, 2024
4ac02e5
Merge branch 'main' into jryan/wnmgds-2864-utility-actions-guidance
jack-ryan-nava-pbc Aug 15, 2024
50911ac
Making left icon boolean text explicitly relate to Figma
jack-ryan-nava-pbc Aug 16, 2024
6721713
Ghost buttons and two columns
jack-ryan-nava-pbc Aug 16, 2024
d5a0d61
Addressed much feedback
jack-ryan-nava-pbc Aug 19, 2024
d12cf83
Revise examples box
jack-ryan-nava-pbc Aug 21, 2024
4da4f31
[NO-TICKET] Automatically format json files (#3206)
pwolfert Aug 20, 2024
6c68601
[WNMGDS-2875] Fix Release script take 2 (#3205)
jack-ryan-nava-pbc Aug 21, 2024
fbde14f
[RELEASE] 8/12 Version bump main (#3200)
tamara-corbalt Aug 22, 2024
8a06f39
[WNMGDS-2884] Add `cmsds-migrate` script for v11 CSS changes (#3208)
pwolfert Aug 22, 2024
008bce2
[WNMGDS-2890] Fix `onAnalyticsEvent` attribute rendering to DOM throu…
pwolfert Aug 26, 2024
cd79888
[NO-TICKET] Define a better return type for `defaultMenuLinks` (#3211)
pwolfert Aug 28, 2024
6ad4135
[NO-TICKET] Revises release v11 blog post (#3213)
kim-cmsds Sep 3, 2024
199da3c
[NO-TICKET] Exclude core design system from dependency update (#3217)
jack-ryan-nava-pbc Sep 4, 2024
57236da
[WNMGDS-2713] Add default value overrides to Storybook (#3216)
jack-ryan-nava-pbc Sep 5, 2024
07a699b
[WNMGDS-2838] Update all themes to make inline tool tips black (#3199)
jack-ryan-nava-pbc Sep 5, 2024
b88f57e
Revert "Updating snapshots"
jack-ryan-nava-pbc Aug 12, 2024
536ed37
Addition of tabble and new content
jack-ryan-nava-pbc Sep 5, 2024
b0ada37
Added content and table
jack-ryan-nava-pbc Sep 6, 2024
84ae5aa
Merge branch 'main' into jryan/wnmgds-2864-utility-actions-guidance
jack-ryan-nava-pbc Sep 6, 2024
5248269
Fixed table and aria labels
jack-ryan-nava-pbc Sep 9, 2024
90c543c
Merge branch 'main' into jryan/wnmgds-2864-utility-actions-guidance
jack-ryan-nava-pbc Sep 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
163 changes: 163 additions & 0 deletions packages/docs/content/patterns/utility-actions.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
---
title: Utility Actions
intro: Utility actions for a webpage including print, email, RSS and more.
core:
figmaNodeId: 4744-4695
---
jack-ryan-nava-pbc marked this conversation as resolved.
Show resolved Hide resolved

import {
Button,
DownloadIcon,
EmailIcon,
LinkIcon,
PrintIcon,
RssIcon,
Table,
TableBody,
TableCaption,
TableCell,
TableHead,
TableRow,
WhatsNewIcon,
} from '@cmsgov/design-system';

## Example

The example below shows utility actions for Print, Email and RSS.

<EmbeddedExample>
<div className="ds-l-row ds-u-justify-content--end">
<div className="ds-l-col--2">
<Button variation="ghost" size="small">
<PrintIcon ariaHidden={false} className="ds-u-margin-right--1" />
Print
</Button>
</div>
<div className="ds-l-col--2">
<Button variation="ghost" size="small">
<EmailIcon ariaHidden={false} className="ds-u-margin-right--1" />
Email
</Button>
</div>
<div className="ds-l-col--2">
<Button variation="ghost" size="small">
<RssIcon ariaHidden={false} className="ds-u-margin-right--1" />
RSS
</Button>
</div>
</div>
</EmbeddedExample>

### Available Actions

In Figma, use the toggle feature to select different utility actions.

<Table>
<TableCaption>Available utility actions include:</TableCaption>
<TableHead>
<TableRow>
<TableCell key="utility" id="utility">
Utility
</TableCell>
<TableCell key="action" id="action">
Action
</TableCell>
</TableRow>
</TableHead>
<TableBody>
<TableRow key="Print">
<TableCell key="Utility" headers="utility" stackedTitle="Print Icon">
<Button variation="ghost" size="medium">
<PrintIcon ariaHidden={false} className="ds-u-margin-right--1" />
Print
</Button>
</TableCell>
<TableCell key="Action" headers="action" stackedTitle="Print description.">
Opens print terminal
</TableCell>
</TableRow>
<TableRow key="Email">
<TableCell key="Utility" headers="utility" stackedTitle="Email Icon">
<Button variation="ghost" size="medium">
<EmailIcon ariaHidden={false} className="ds-u-margin-right--1" />
Email
</Button>
</TableCell>
<TableCell key="Action" headers="action" stackedTitle="Email description.">
Opens default desktop email app
</TableCell>
</TableRow>
<TableRow key="RSS">
<TableCell key="Utility" headers="utility" stackedTitle="RSS Icon">
<Button variation="ghost" size="medium">
<RssIcon ariaHidden={false} className="ds-u-margin-right--1" />
RSS
</Button>
</TableCell>
<TableCell key="Action" headers="action" stackedTitle="RSS description.">
Opens an XML feed in a different tab
</TableCell>
</TableRow>
<TableRow key="Link">
<TableCell key="Utility" headers="utility" stackedTitle="Link Icon">
<Button variation="ghost" size="medium">
<LinkIcon ariaHidden={false} className="ds-u-margin-right--1" />
Link
</Button>
</TableCell>
<TableCell key="Action" headers="action" stackedTitle="Link description.">
Copies link for current page to clipboard
</TableCell>
</TableRow>
<TableRow key="Download">
<TableCell key="Utility" headers="utility" stackedTitle="Download Icon">
<Button variation="ghost" size="medium">
<DownloadIcon ariaHidden={false} className="ds-u-margin-right--1" />
Download
</Button>
</TableCell>
<TableCell key="Action" headers="action" stackedTitle="Download description.">
Initiates download
</TableCell>
</TableRow>
<TableRow key="What's New">
<TableCell key="Utility" headers="utility" stackedTitle="What's New Icon">
<Button variation="ghost" size="medium">
<WhatsNewIcon ariaHidden={false} className="ds-u-margin-right--1" />
What's New
</Button>
</TableCell>
<TableCell key="Action" headers="action" stackedTitle="What's New description.">
Opens sidebar with updates
</TableCell>
</TableRow>
</TableBody>
</Table>

## When to use

- Content on a webpage or a document is something a user would want to be able to refer back to - provide options to print, email, or download.
- If you would like to give the user the option to:
- Open an XML feed in a different tab
- Copy a link to a webpage
- Open a popup with new updates or new website capabilities

### Usage

- Utility actions are ghost buttons for available actions that do not take priority over primary or secondary call-to-actions (CTAs).
- Placement should be in the page header and top, right aligned.
Copy link
Collaborator

@tamara-corbalt tamara-corbalt Sep 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a suggestion, but it might be clearer to write "top-right aligned" vs "top, right aligned."

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but since this is approved copy we'll keep it as is. Thanks!

- Include no more than 3 utility actions on a page to prevent cluttering the user interface (UI) and distracting the user.
- When pairing 2 or more utility action buttons, the preferred action goes on the left.
- Be consistent with the inclusion of utility actions and their order across pages and products.
- Follow any additional governance established by your UX and content lead for which utility actions to include.

### When to consider alternatives

- If an action (e.g. printing or emailing) is a critical call-to-action on a webpage, consider using a solid or outlined main button.
- If the utility action is opening a link in a new webpage versus triggering an action, refer to [guidance on links](/foundation/typography/links).
- Carefully consider which utility actions are used on mobile (since space is a premium.)

## Accessibility

- Always include both the icon and label in utility actions to meet accessibility standards.
- Don't create CTAs that duplicate utility actions on a page. Having multiple "print" actions on a page can hinder accessibility for screen reader users.