Skip to content

Commit 3526fc2

Browse files
laurkimnayeobkim
andauthored
[polaris.shopify.com] Add best practices for Text, AlphaStack, and AlphaCard (#8614)
### WHY are these changes introduced? There are repos in the Shopify org that link best practices on Text, Stack, and Card. AlphaCard has best practices but AlphaStack and Text don't. ### WHAT is this pull request doing? Adds: - Best practices to Text from Heading, Caption, TextStyle, and VisuallyHidden - Best practices to AlphaStack from LegacyStack Supplements: - Best practices for AlphaCard from LegacyCard <!-- ℹ️ Delete the following for small / trivial changes --> ### How to 🎩 🖥 [Local development instructions](https://github.com/Shopify/polaris/blob/main/README.md#local-development) 🗒 [General tophatting guidelines](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md) 📄 [Changelog guidelines](https://github.com/Shopify/polaris/blob/main/.github/CONTRIBUTING.md#changelog) ### 🎩 checklist - [ ] Tested on [mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing) - [ ] Tested on [multiple browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers) - [ ] Tested for [accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md) - [ ] Updated the component's `README.md` with documentation changes - [x] [Tophatted documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md) changes in the style guide --------- Co-authored-by: Nayeob Kim <[email protected]>
1 parent dca759b commit 3526fc2

File tree

4 files changed

+61
-0
lines changed

4 files changed

+61
-0
lines changed

.changeset/sharp-keys-march.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'polaris.shopify.com': patch
3+
---
4+
5+
Added best practices to `Text`, `AlphaCard`, and `AlphaStack`

polaris.shopify.com/content/components/layout-and-structure/alpha-card.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,7 @@ Cards should:
4646

4747
- Group related information
4848
- Display information in a way that prioritizes what the merchant needs to know most first
49+
- Use headings that set clear expectations about the card’s purpose
50+
- Stick to single user flows or break more complicated flows into multiple sections
51+
- Avoid too many call-to-action buttons or links and only one primary call to action per card
52+
- Use calls to action on the bottom of the card for next steps and use the space in the upper right corner of the card for persistent, optional actions (such as Edit)

polaris.shopify.com/content/components/layout-and-structure/alpha-stack.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ examples:
2626
Use to horizontally align Stack.
2727
---
2828

29+
## Best practices
30+
31+
Stacks should:
32+
33+
- Not be used for complex or unique arrangements of components
34+
- Not be used for large-scale page layout
35+
36+
---
37+
2938
## Related components
3039

3140
- To display elements horizontally, [use the Inline component](https://polaris.shopify.com/components/inline)

polaris.shopify.com/content/components/typography/text.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,46 @@ These are suggested replacements for existing text style components, but ultimat
172172
- </VisuallyHidden>
173173
+ <Text visuallyHidden as="h2">Title and description</Text>
174174
```
175+
176+
---
177+
178+
## Best practices
179+
180+
### Headings
181+
182+
Headings use all the variants with `heading` in the name, such as `headingMd`. Headings should:
183+
184+
- Clearly describe the section of interface they refer to
185+
- Highlight the most important concept or piece of information merchants need to know
186+
- Sit at the top of the section of interface they’re referring to
187+
188+
### Captions
189+
190+
Captions use the `bodySm` Text variant.
191+
192+
- Use for secondary labels in graphs and charts
193+
- May be used for timestamps in lists of content
194+
- Don’t use this variant for other cases
195+
- Don’t use this variant for text longer than a few words
196+
- Don’t use this variant for aesthetic effect or to break from the standard text size
197+
198+
### Text styles
199+
200+
Text styles should be:
201+
202+
- Used when enhancing the text to help merchants understand its meaning
203+
- Subdued if the text is less important than its surrounding text
204+
- Warning if the text denotes something that needs attention, or that merchants need to take action on.
205+
- Semibold for input fields, or for a row total in a price table
206+
- Paired with symbols, like an arrow or dollar sign, when using success or critical styles
207+
208+
### Visually hidden
209+
210+
Visually hidden text should:
211+
212+
- Not be used if semantic markup can make content understandable to people using assistive technology
213+
- Be used to provide extra context when semantic markup isn’t enough
214+
- Be used on any content that is normally present but is being omitted
215+
- Make sense in context when used with a screen reader
216+
217+
---

0 commit comments

Comments
 (0)