Polaris code example updates for Action components#3944
Polaris code example updates for Action components#3944timtrevor-shopify wants to merge 15 commits into2026-01from
Conversation
abf6706 to
9870327
Compare
|
We detected some changes in |
mcvinci
left a comment
There was a problem hiding this comment.
Nice improvements, @timtrevor-shopify! I added a few suggestions, and happy to chat through any feedback, too.
| ], | ||
| image: 'button-default.png', | ||
| description: | ||
| 'Group related buttons together with a primary action and secondary options. This example shows a button group with a save button and a cancel button using the slot layout.', |
There was a problem hiding this comment.
Doesn't look like any of the default html files were added to this PR
packages/ui-extensions/src/surfaces/admin/components/Clickable/Clickable.doc.ts
Outdated
Show resolved
Hide resolved
packages/ui-extensions/src/surfaces/admin/components/Clickable/Clickable.doc.ts
Outdated
Show resolved
Hide resolved
packages/ui-extensions/src/surfaces/admin/components/Clickable/Clickable.doc.ts
Outdated
Show resolved
Hide resolved
packages/ui-extensions/src/surfaces/admin/components/Clickable/Clickable.doc.ts
Outdated
Show resolved
Hide resolved
packages/ui-extensions/src/surfaces/admin/components/ClickableChip/ClickableChip.doc.ts
Outdated
Show resolved
Hide resolved
packages/ui-extensions/src/surfaces/admin/components/ClickableChip/ClickableChip.doc.ts
Outdated
Show resolved
Hide resolved
packages/ui-extensions/src/surfaces/admin/components/Link/Link.doc.ts
Outdated
Show resolved
Hide resolved
packages/ui-extensions/src/surfaces/admin/components/Link/Link.doc.ts
Outdated
Show resolved
Hide resolved
…/Clickable.doc.ts Co-authored-by: Michelle Vinci <michelle.vinci@shopify.com>
…/Clickable.doc.ts Co-authored-by: Michelle Vinci <michelle.vinci@shopify.com>
…/Clickable.doc.ts Co-authored-by: Michelle Vinci <michelle.vinci@shopify.com>
…/Clickable.doc.ts Co-authored-by: Michelle Vinci <michelle.vinci@shopify.com>
…Chip/ClickableChip.doc.ts Co-authored-by: Michelle Vinci <michelle.vinci@shopify.com>
…Chip/ClickableChip.doc.ts Co-authored-by: Michelle Vinci <michelle.vinci@shopify.com>
….doc.ts Co-authored-by: Michelle Vinci <michelle.vinci@shopify.com>
….doc.ts Co-authored-by: Michelle Vinci <michelle.vinci@shopify.com>
Fionoble
left a comment
There was a problem hiding this comment.
Need to add the missing html files
There was a problem hiding this comment.
Looking good @timtrevor-shopify ! Added a few suggestions to take a look at before merging.
Claude and I also did a quick pass on the example code. But I couldn't track down a PR with any examples in them. So I'll note them here:
Code review (.html + .jsx example files)
Link
links-with-different-tones.html vs .jsx: HTML labels don't match tones. HTML says "Neutral tone" for tone="success" and "Subdued tone" for tone="caution". JSX correctly says "Success tone" and "Caution tone".
- Files:
Link/examples/links-with-different-tones.htmlL6,Link/examples/links-with-different-tones.jsxL6
links-with-different-tones.html: Zero href attributes across all 6 <s-link> elements. Links without href don't navigate.
- File:
Link/examples/links-with-different-tones.html
links-with-language-attribute.html: No href attribute on the <s-link>.
- File:
Link/examples/links-with-language-attribute.html
default.html and default.jsx: On the base branch (not changed in this PR). HTML uses href="#beep", JSX uses href="javascript:void(0)". Both have typo "fufilling" (should be "fulfilling"). Worth flagging for whoever owns the base.
- Files:
Link/examples/default.html,Link/examples/default.jsx
Menu
menu-with-links-and-disabled-items.html vs .jsx: Different download button behavior. HTML: <s-button download href="javascript:void(0)"> (bare boolean download, placeholder href). JSX: <s-button download="sales-report.csv" href="/reports/sales-report.csv"> (filename + real path). HTML and JSX should match.
- Files:
Menu/examples/menu-with-links-and-disabled-items.htmlL8,Menu/examples/menu-with-links-and-disabled-items.jsxL9
| }, | ||
| { | ||
| description: | ||
| 'Embed links within paragraph text so merchants can navigate to related content inline. This example shows two links inside a paragraph that inherit the surrounding text tone.', |
There was a problem hiding this comment.
The "basic-links-in-paragraph" example demonstrates inline links within a Paragraph. I'd consider adding a link to the Paragraph component in the description.
| ], | ||
| image: 'button-default.png', | ||
| description: | ||
| 'Group related buttons together with a primary action and secondary options. This example shows a button group with a save button and a cancel button using the slot layout.', |
There was a problem hiding this comment.
Do we define what a slot layout is on the page or code? Not sure what that is.
| }, | ||
| { | ||
| description: | ||
| 'Add icons to grouped buttons to help merchants quickly identify each action. This example shows duplicate, archive, and delete buttons with icons.', |
There was a problem hiding this comment.
| 'Add icons to grouped buttons to help merchants quickly identify each action. This example shows duplicate, archive, and delete buttons with icons.', | |
| 'Add icons to grouped buttons to identify each action. This example shows duplicate, archive, and delete buttons with icons.', |
There was a problem hiding this comment.
I'm not fond of my rewrite. But I don't think we need to say 'help merchants quickly".
| }, | ||
| { | ||
| description: | ||
| 'Embed a clickable component within a content section to provide an interactive action alongside text. This example shows a styled clickable button inside a box with a heading and description.', |
There was a problem hiding this comment.
"to provide an interactive action alongside text" feels a lttle vague to me. We could be more specific.
| }, | ||
| ], | ||
| description: | ||
| 'Create an interactive chip that merchants can click to trigger an action. This example shows a clickable chip component with default styling.', |
There was a problem hiding this comment.
"that merchants can click to trigger an action" -- restates what "interactive" and "clickable" mean. The second sentence isn't adding much besides 'default styling'.
| }, | ||
| { | ||
| description: | ||
| 'Add an icon and a remove button so merchants can see status at a glance and dismiss the chip. This example shows a removable chip with a check circle icon in the graphic slot.', |
There was a problem hiding this comment.
| 'Add an icon and a remove button so merchants can see status at a glance and dismiss the chip. This example shows a removable chip with a check circle icon in the graphic slot.', | |
| 'Add an icon and a remove button so merchants can see the status and dismiss the chip. This example shows a removable chip with a check circle icon in the graphic slot.', |
| ], | ||
| image: 'link-default.png', | ||
| description: | ||
| 'Add an inline link to let merchants navigate to another page. This example shows a basic text link with an `href` property.', |
There was a problem hiding this comment.
The code behind this example has a typo.
Current: fufilling orders
Fix: fulfilling orders
We could also show it in context:
<s-paragraph>
Your product catalog is empty. Start by <s-link href="javascript:void(0)">adding your first product</s-link> or <s-link href="javascript:void(0)">importing existing inventory</s-link>.
</s-paragraph><s-paragraph>
Your product catalog is empty. Start by <s-link href="javascript:void(0)">adding your first product</s-link> or <s-link href="javascript:void(0)">importing existing inventory</s-link>.
</s-paragraph>| }, | ||
| { | ||
| description: | ||
| 'Configure links to inherit the tone of their parent paragraph to match the surrounding context. This example shows links inside paragraphs with six different tones.', |
There was a problem hiding this comment.
"Configure links to inherit" is passive/abstract. Could rephrase this one.
There was a problem hiding this comment.
| 'Configure links to inherit the tone of their parent paragraph to match the surrounding context. This example shows links inside paragraphs with six different tones.', | |
| 'Configure links that inherit the tone of their parent paragraph and match the surrounding context. This example shows links inside paragraphs with six different tones.', |
| }, | ||
| { | ||
| description: | ||
| 'Organize menu items into labeled groups so merchants can quickly find related actions. This example shows two sections with headings separating product actions from export options.', |
There was a problem hiding this comment.
| 'Organize menu items into labeled groups so merchants can quickly find related actions. This example shows two sections with headings separating product actions from export options.', | |
| 'Organize menu items into labeled groups so merchants can find related actions. This example shows two sections with headings separating product actions from export options.', |
| }, | ||
| { | ||
| description: | ||
| 'Use the `color` property to visually distinguish chips by importance or category. This example shows three chips with base, subdued, and strong color variants.', |
There was a problem hiding this comment.
| 'Use the `color` property to visually distinguish chips by importance or category. This example shows three chips with base, subdued, and strong color variants.', | |
| 'Use the `color` property to visually distinguish chips by importance or category. This example shows three chips with `base`, `subdued`, and `strong` color variants.', |
| }, | ||
| { | ||
| description: | ||
| 'Configure links to inherit the tone of their parent paragraph to match the surrounding context. This example shows links inside paragraphs with six different tones.', |
There was a problem hiding this comment.
| 'Configure links to inherit the tone of their parent paragraph to match the surrounding context. This example shows links inside paragraphs with six different tones.', | |
| 'Configure links that inherit the tone of their parent paragraph and match the surrounding context. This example shows links inside paragraphs with six different tones.', |

Background
As part of an overall update to the App Home / App Bridge docs, we're improving the titles and descriptions of code examples for Polaris components, as well as removing any redundant examples, and adding new examples for missing use cases.
Solution
This PR makes updates to the following component pages:
ButtonGroup
Clickable
ClickableChip
Link
Menu
The following code examples have been added and removed:
ButtonGroup
Removed example files:
basic-usage.html / .jsx— Redundant with the default example; both showed a Cancel + Save button pair using the primary-action and secondary-actions slots.form-action-buttons.html / .jsx— Redundant with the default example; same Cancel + Save pattern with only the label text changed to "Save product".Clickable
Removed example files:
basic-button-usage.html / .jsx— Redundant with the default example; showed a single clickable with border and padding, which is a strict subset of the default that already demonstrates two clickable elements with those same props.ClickableChip
Removed example files:
multiple-chips-with-proper-spacing.html / .jsx— Redundant composite of concepts already covered individually by the color variants, icon/removable, and subdued/icon examples. The title focused on layout spacing which is an s-stack concern, not a ClickableChip concept.Link
Removed example files:
links-with-auto-tone.html / .jsx— Redundant with "Basic Links in Paragraph"; both showed links inside a regular paragraph with no new concept.links-in-banner-context.html / .jsx— Redundant with "Links in Banner"; same pattern of a link inside a banner, just a different tone value (warning vs info).links-in-subdued-paragraph.html / .jsx— Redundant with "Links with Different Tones" which comprehensively covers links inheriting tone from six different paragraph tones.critical-context-links.html / .jsx— Redundant with "Links with Different Tones" which includes a critical tone example among others.Menu
Removed example files:
basic-menu.html / .jsx— Redundant with the default example; both showed a trigger button with three icon buttons in the menu.menu-with-icons.html / .jsx— Redundant with the default example; the only new element was a caret-down icon on the trigger button, which didn't warrant a separate example.Added example files:
icon-only-trigger.html / .jsx— Added to fill a gap; no existing example showed the common "three-dot menu" pattern where an icon-only button triggers the menu, which is one of the most frequent menu patterns in real apps.🎩
To TopHat these changes, checkout the branch
PolarisCodeExampleUpdates2and runyarn docs:admin 2026-01.In the shopify-dev repo, confirm the
db/data/docs/templated_apis/app_home/generated_docs_data.jsonhas been updated and rundev sfor a local preview.Checklist