Skip to content

Commit c60af22

Browse files
authored
Add best practices to all customer account components (#3490)
### Background Part of shop/issues-checkout#8472 Part of shop/issues-checkout#8578 Part of shop/issues-checkout#8511 Part of shop/issues-checkout#8508 Part of shop/issues-checkout#8507 Part of shop/issues-checkout#8509 Part of shop/issues-checkout#8510 Part of shop/issues-checkout#8512 Related to Shopify/shopify-dev#63804 This PR improves the documentation for Customer Account UI Extension components by enhancing best practices sections with more detailed, actionable guidance. ### Solution Updated the best practices sections for multiple components to provide clearer, more specific guidance for developers. The changes include: - **Avatar**: Improved readability with better formatting and more concise language - **ButtonGroup**: Added a new best practices section with guidelines for grouping actions - **CustomerAccountAction**: Expanded guidance on information collection and form design - **ImageGroup**: Added recommendations for accessibility and visual spacing - **Menu**: Restructured content with clearer headings and more detailed organization principles - **Page**: Reorganized with clear subsections for headings, subheadings, and page-level actions - **Section**: Added a new best practices section with guidance on headings and actions These improvements make the documentation more actionable and help developers create more consistent, user-friendly interfaces. ### 🎩 See Shopify/shopify-dev#63804 for details ### Checklist - [x] I have 🎩'd these changes - [ ] I have updated relevant documentation
1 parent 5fd7f43 commit c60af22

File tree

10 files changed

+142
-44
lines changed

10 files changed

+142
-44
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.

packages/ui-extensions/src/surfaces/customer-account/components/Avatar/Avatar.doc.ts

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,25 +41,30 @@ const data: ReferenceEntityTemplateSchema = {
4141
{
4242
type: 'Generic',
4343
anchorLink: 'best-practices',
44-
title: 'Best Practices',
44+
title: 'Best practices',
4545
sectionContent: `
46-
- By default, if a user does not provide their first or last name, the avatar component will display a placeholder icon. However, if at least one of the names is provided, the avatar will be replaced with one or two initials representing the user.
47-
- There are 5 sizes for the avatar component:
48-
* small-200 (21x21 px): Use when showing avatars in tables / lists where space is limited.
49-
* small (26x26 px): Use when you want to conserve space but want a larger size than small-200.
50-
* base (32x32 px): Use by default.
51-
* large (39×39 px): Use when the avatar is a focal point, such as a customer details card.
52-
* large-200 (47x47 px): Use when placing more emphasis on the avatar.
46+
Use these best practices to deliver a clear and accessible experience in your extensions.
5347
54-
- Provide alt text for avatars to assist customers using assistive technologies.
48+
### Show initials by default
5549
56-
**Dos**
57-
- When using multiple avatars on the same page, maintain a consistent style and size to create a unified visual pattern for users.
50+
When no first or last name is provided, display the placeholder icon. If either name exists, show one or two initials.
5851
59-
**Don'ts**
60-
- Don't use different size avatars on the same page.
52+
### Choose an appropriate size
6153
62-
![An example showing dos and don'ts of the Avatar component](/assets/templated-apis-screenshots/customer-account-ui-extensions/2025-10/avatar-best-practices.png)
54+
Select a size based on context:
55+
- small‑200 (21×21) for tight tables or lists
56+
- small (26×26) when slightly larger is needed
57+
- base (32×32) as the default
58+
- large (39×39) when the avatar is a focal point (for example, a customer card)
59+
- large‑200 (47×47) when extra emphasis is required
60+
61+
### Provide descriptive alt text
62+
63+
Write alt text that meaningfully describes the avatar so assistive technologies can convey the same context.
64+
65+
### Keep sizes consistent on a page
66+
67+
Use the same style and size for multiple avatars in one view to create a unified visual pattern and avoid mixing sizes.
6368
`,
6469
},
6570
],

packages/ui-extensions/src/surfaces/customer-account/components/ButtonGroup/ButtonGroup.doc.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,36 @@ When used within a [Section](/docs/api/customer-account-ui-extensions/polaris-we
3838
],
3939
},
4040
},
41+
subSections: [
42+
{
43+
type: 'Generic',
44+
anchorLink: 'best-practices',
45+
title: 'Best practices',
46+
sectionContent: `
47+
Use these best practices to deliver a clear and accessible experience in your extensions.
48+
49+
### Prioritize and group related actions
50+
51+
Cluster actions by purpose and place the most important or common action first to set a clear default.
52+
53+
### Use a single primary action
54+
55+
Reserve the primary style for one action only. Keep all other actions secondary to reinforce hierarchy.
56+
57+
### Reduce clutter in secondary options
58+
59+
Limit the number of secondary actions and collapse extras into menus or overflow to keep the interface clean.
60+
61+
### Write short, scannable labels
62+
63+
Use verbs and nouns in sentence cases. For example, “Edit address”. Keep styling consistent across actions.
64+
65+
### Support accessibility and responsiveness
66+
67+
Provide an accessible label for the group and ensure the layout adapts well across screen sizes.
68+
`,
69+
},
70+
],
4171
related: [],
4272
};
4373

packages/ui-extensions/src/surfaces/customer-account/components/CustomerAccountAction/CustomerAccountAction.doc.ts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,29 @@ const data: ReferenceEntityTemplateSchema = {
4646
{
4747
type: 'Generic',
4848
anchorLink: 'best-practices',
49-
title: 'Best Practices',
49+
title: 'Best practices',
5050
sectionContent: `
51-
- Use CustomerAccountAction to shift focus toward information and functionality needed to confirm or complete an order action.
52-
- If the order action experience you’re building requires complex forms or large amounts of information, consider building a full-page extension instead.
53-
- See Polaris for more best practices and content guidelines for designing [Modals](https://polaris.shopify.com/components/overlays/modal#best-practices).
51+
Use these best practices to deliver a clear and accessible experience in your extensions.
52+
53+
### Highlight the key decision
54+
55+
Use the component to present the essential details and actions needed to confirm or complete an order task.
56+
57+
### Collect only what’s necessary
58+
59+
Request the minimum information required to finish the customer’s job so the flow stays quick and friction‑free.
60+
61+
### Keep forms simple and predictable
62+
63+
Use clear labels, intuitive actions, and concise copy so customers know what’s required and what happens next.
64+
65+
### Choose a full‑page extension for complex flows
66+
67+
If the task spans multiple steps or needs a lot of input, switch to a full‑page extension instead of a modal.
68+
69+
### Refer to Polaris guidance
70+
71+
Refer to Polaris for additional best practices and content guidelines when designing [modals](https://polaris-react.shopify.com/components/deprecated/modal#best-practices).
5472
`,
5573
},
5674
],

packages/ui-extensions/src/surfaces/customer-account/components/ImageGroup/ImageGroup.doc.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,21 @@ const data: ReferenceEntityTemplateSchema = {
3535
{
3636
type: 'Generic',
3737
anchorLink: 'best-practices',
38-
title: 'Best Practices',
38+
title: 'Best practices',
3939
sectionContent: `
40-
- Optimize image file sizes and consider lazy loading for performance.
40+
Use these best practices to deliver a clear and accessible experience in your extensions.
41+
42+
### Write concise alt text for each image
43+
44+
Describe what’s important about each image so all users can understand the content.
45+
46+
### Optimize performance
47+
48+
Compress images and use modern formats; consider lazy loading to reduce initial load times.
49+
50+
### Preserve visual breathing room
51+
52+
Maintain consistent spacing around the group so images don’t feel crowded or overwhelming.
4153
`,
4254
},
4355
],

packages/ui-extensions/src/surfaces/customer-account/components/Menu/Menu.doc.ts

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,29 @@ const data: ReferenceEntityTemplateSchema = {
4141
{
4242
type: 'Generic',
4343
anchorLink: 'best-practices',
44-
title: 'Best Practices',
44+
title: 'Best practices',
4545
sectionContent: `
46-
### Consolidate actions into one menu
46+
Use these best practices to deliver a clear and accessible experience in your extensions.
4747
48-
- Use the menu component in the upper-right corner of full-page extensions, to be consistent with the **Order status** page.
49-
- Use menus to consolidate page-level actions, instead of adding multiple buttons around the page.
48+
### Place menus consistently
5049
51-
![The “Don’t do” example shows 3 separate action buttons on a subscription page. The “Do” example shows the same 3 actions consolidated into one menu.](/assets/templated-apis-screenshots/customer-account-ui-extensions/2025-10/menu-dont-do.png)
50+
Position menus in the upper‑right of full‑page extensions to match account pages like order status.
5251
53-
### Content guidelines
52+
### Group page‑level actions
5453
55-
When writing button labels:
56-
- Aim for 2 words (verb and noun).
57-
- Lead with a strong verb that encourages action.
58-
- Avoid unnecessary words and articles such as “the,” “an,” or “a.”
59-
- Use sentence case.
54+
Keep related actions in a single menu rather than scattering buttons across the page.
6055
61-
![A button that follows the content guidelines says “Skip order”. A button that does not meet the content guidelines says “Skip this order”.](/assets/templated-apis-screenshots/customer-account-ui-extensions/2025-10/menu-labels.png)
56+
### Limit items to what’s relevant
57+
58+
Include only actions that matter for the current page to reduce decision fatigue.
59+
60+
### Order by frequency and risk
61+
62+
List the most common or least risky actions at the top so they’re easy to reach.
63+
64+
### Write concise, action‑first labels
65+
66+
Use short labels (ideally two words) that start with a verb, use sentence case, avoid filler articles, and clearly state the outcome.
6267
`,
6368
},
6469
],

packages/ui-extensions/src/surfaces/customer-account/components/Page/Page.doc.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,21 @@ const data: ReferenceEntityTemplateSchema = {
5858
{
5959
type: 'Generic',
6060
anchorLink: 'best-practices',
61-
title: 'Best Practices',
61+
title: 'Best practices',
6262
sectionContent: `
63-
**Heading**
64-
- Set clear expectations about the purpose and main topic of the page.
65-
- Aim for 1-3 words.
66-
- Use sentence case.
63+
Use these best practices to deliver a clear and accessible experience in your extensions.
6764
68-
**Subheading**
69-
- Use to provide additional context or information that enhances the customer’s understanding of the page.
70-
- Use subheadings sparingly and only when they add useful information that is distinct from the heading.
65+
### Write clear, focused headings
7166
72-
**Buttons**
73-
- Use for page-level actions only.
74-
- If there is a single primary action for the page, display it as a primary button. Display all other page-level actions as secondary buttons.
75-
- See [UX guidelines](/docs/apps/customer-accounts/order-action-menu-extensions/ux-guidelines) to learn more about the button logic for order actions.
67+
State the main purpose of the page in a few words and use sentence case for readability.
68+
69+
### Use subheadings only when they add value
70+
71+
Add a subheading when it provides helpful context that’s different from the heading. Keep it brief and use sparingly to avoid clutter.
72+
73+
### Add page‑level actions thoughtfully
74+
75+
Include buttons in the header only for actions that affect the entire page or flow. Make the main action a primary button, keep lesser actions secondary, limit the total number, and follow established UX patterns—especially for order actions.
7676
`,
7777
},
7878
],

packages/ui-extensions/src/surfaces/customer-account/components/Section/Section.doc.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,34 @@ const data: ReferenceEntityTemplateSchema = {
2020
anchorLink: 'considerations',
2121
sectionContent: `- When adding headings inside sections they automatically use a specific style, which helps keep the content organized and clear.`,
2222
},
23+
{
24+
type: 'Generic',
25+
anchorLink: 'best-practices',
26+
title: 'Best practices',
27+
sectionContent: `
28+
Use these best practices to deliver a clear and accessible experience in your extensions.
29+
30+
### Describe each section with a clear heading
31+
32+
Use concise, sentence‑case headings that reflect the section’s purpose.
33+
34+
### Provide an accessible name when no heading exists
35+
36+
If a visual heading isn’t present, set an accessibilityLabel so assistive technologies can identify the section.
37+
38+
### Align actions to the section’s content
39+
40+
Only include primary and secondary actions that relate directly to what’s in the section.
41+
42+
### Limit and prioritize actions
43+
44+
Keep the number of actions small to reduce noise and emphasize what matters most.
45+
46+
### Keep layout and styling consistent
47+
48+
Maintain consistent spacing, typography, and alignment between sections for a coherent experience.
49+
`,
50+
},
2351
],
2452
definitions: [
2553
{

0 commit comments

Comments
 (0)