Skip to content

Comments

Polaris code example updates for Action components#3944

Open
timtrevor-shopify wants to merge 15 commits into2026-01from
PolarisCodeExampleUpdates2
Open

Polaris code example updates for Action components#3944
timtrevor-shopify wants to merge 15 commits into2026-01from
PolarisCodeExampleUpdates2

Conversation

@timtrevor-shopify
Copy link
Contributor

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 PolarisCodeExampleUpdates2 and run yarn docs:admin 2026-01.
In the shopify-dev repo, confirm the db/data/docs/templated_apis/app_home/generated_docs_data.json has been updated and run dev s for a local preview.

Checklist

  • I have 🎩'd these changes
  • I have updated relevant documentation

@timtrevor-shopify timtrevor-shopify force-pushed the PolarisCodeExampleUpdates2 branch from abf6706 to 9870327 Compare February 20, 2026 22:27
@github-actions
Copy link
Contributor

We detected some changes in packages/*/package.json or packages/*/src, and there are no updates in the .changeset directory. If the changes are user-facing and should cause a version bump, run yarn changeset to track your changes and include them in the next release CHANGELOG. If you are making simple updates to repo configuration, examples, or documentation, you do not need to add a changeset.

Copy link
Contributor

@mcvinci mcvinci left a comment

Choose a reason for hiding this comment

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

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.',
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if this is a locally previewing issue, or an actual issue, but I'm not seeing the html title in the codeblock, and the preview seems collapsed. Might be worthwhile double-checking?

Image

Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't look like any of the default html files were added to this PR

timtrevor-shopify and others added 8 commits February 20, 2026 16:28
…/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>
Copy link
Contributor

@Fionoble Fionoble left a comment

Choose a reason for hiding this comment

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

Need to add the missing html files

Copy link
Contributor

@SteveSill SteveSill left a comment

Choose a reason for hiding this comment

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

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.html L6, Link/examples/links-with-different-tones.jsx L6

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.html L8, Menu/examples/menu-with-links-and-disabled-items.jsx L9

},
{
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.',
Copy link
Contributor

Choose a reason for hiding this comment

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

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.',
Copy link
Contributor

Choose a reason for hiding this comment

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

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.',
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
'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.',

Copy link
Contributor

Choose a reason for hiding this comment

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

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.',
Copy link
Contributor

Choose a reason for hiding this comment

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

"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.',
Copy link
Contributor

Choose a reason for hiding this comment

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

"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.',
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
'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.',
Copy link
Contributor

Choose a reason for hiding this comment

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

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.',
Copy link
Contributor

Choose a reason for hiding this comment

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

"Configure links to inherit" is passive/abstract. Could rephrase this one.

Choose a reason for hiding this comment

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

Suggested change
'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.',
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
'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.',

Choose a reason for hiding this comment

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

Suggested change
'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.',

Choose a reason for hiding this comment

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

Suggested change
'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.',

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants