Polaris code example updates for Action components#3944
Polaris code example updates for Action components#3944timtrevor-shopify wants to merge 21 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.
packages/ui-extensions/src/surfaces/admin/components/ButtonGroup/ButtonGroup.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/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
packages/ui-extensions/src/surfaces/admin/components/Link/Link.doc.ts
Outdated
Show resolved
Hide resolved
packages/ui-extensions/src/surfaces/admin/components/ButtonGroup/ButtonGroup.doc.ts
Outdated
Show resolved
Hide resolved
packages/ui-extensions/src/surfaces/admin/components/ButtonGroup/ButtonGroup.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
packages/ui-extensions/src/surfaces/admin/components/Menu/Menu.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/ButtonGroup/ButtonGroup.doc.ts
Outdated
Show resolved
Hide resolved
|
@Fionoble All the examples have been fixed to display the HTML examples with an |
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