Skip to content

Comments

Improve examples for Avatar, Checkbox, ColorField, ColorPicker, and Icon#3926

Open
sordaz00 wants to merge 2 commits into2026-01from
uiext-polaris-examples-batch2-clean
Open

Improve examples for Avatar, Checkbox, ColorField, ColorPicker, and Icon#3926
sordaz00 wants to merge 2 commits into2026-01from
uiext-polaris-examples-batch2-clean

Conversation

@sordaz00
Copy link
Contributor

@sordaz00 sordaz00 commented Feb 19, 2026

Updating examples only for App Home polaris components: Avatar, Checkbox, ColorField, ColorPicker, and Icon.

Updates:

  • Improves examples descriptions to 3-sentence structure: What this pattern helps merchants accomplish + What this specific example demonstrates beginning with "This example shows..."
  • Update to action-oriented titles
  • Removes redundant examples

Relates to:
https://github.com/Shopify/shopify-dev/issues/67413
https://github.com/Shopify/shopify-dev/issues/67415
https://github.com/Shopify/shopify-dev/issues/67416
https://github.com/Shopify/shopify-dev/issues/67430
https://github.com/Shopify/shopify-dev/issues/67431

Test plan

  • Verify descriptions render correctly on docs pages

@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.

@sordaz00 sordaz00 changed the title Improve App Home Polaris examples - Batch 2 Improve examples for Avatar, Checkbox, ColorField, ColorPicker, and Icon Feb 19, 2026
Stephanie Ordaz added 2 commits February 19, 2026 18:36
Updates example documentation for Avatar, Checkbox, ColorField, ColorPicker, and Icon components:

- Update all example descriptions to 3-sentence pattern
- Remove 6 redundant examples to reduce noise
- Fix ColorPicker default to show basic picker (no alpha)
- Merge format hint into ColorField default placeholder

Components: Avatar (8), Checkbox (5), ColorField (8), ColorPicker (2), Icon (8)
- Remove JSX tabs, keep HTML with language: 'preview' for interactive previews
- Remove 'Click to interact with the preview.' from all descriptions
- Add missing backticks for property names and values
- Delete unused .jsx example files (keep JSX-only validation examples)
@sordaz00 sordaz00 force-pushed the uiext-polaris-examples-batch2-clean branch from 2a92e82 to 894fc18 Compare February 20, 2026 00:37
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.

Thanks for these improvements, @sordaz00! I think I have similar thoughts as here.

It might be worthwhile revisiting some descriptions to make them a little more closely tied to describing what's happening in the code (referencing specific props, etc). Non-blocking comment though, and definitely something we could consider in a follow-up PR. ❤️

{
description:
'Shows how the component handles store and business names of varying lengths in commerce contexts.',
'Display initials of varying lengths consistently. This example shows avatars with 2, 3, and 4 character initials.',
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
'Display initials of varying lengths consistently. This example shows avatars with 2, 3, and 4 character initials.',
'Display initials of varying lengths consistently. This example shows avatars with two, three, and four character initials.',

{
description:
'Demonstrates avatar integration with other admin-ui components in a merchant section layout.',
'Build rich merchant profile cards. This example shows an avatar combined with Section, Heading, and Text components for a complete layout.',
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
'Build rich merchant profile cards. This example shows an avatar combined with Section, Heading, and Text components for a complete layout.',
'Build rich merchant profile cards. This example shows an avatar combined with [section](/docs/api/{API_NAME}/{API_VERSION}/polaris-web-components/layout-and-structure/section), [heading](/docs/api/{API_NAME}/{API_VERSION}/polaris-web-components/typography-and-content/heading), and [text](/docs/api/{API_NAME}/{API_VERSION}/polaris-web-components/typography-and-content/text) components for a complete layout.',

Copy link
Contributor

Choose a reason for hiding this comment

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

"Build rich merchant profile cards" sounds a little on the market-y side. 😆 Maybe there's a way that we can disambiguate this?

'Build rich merchant profile cards. This example shows an avatar combined with Section, Heading, and Text components for a complete layout.',
codeblock: {
title: 'With Section component',
title: 'Combine with Section',
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
title: 'Combine with Section',
title: 'Build a merchant profile card',

Copy link
Contributor

Choose a reason for hiding this comment

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

Not quite sure this is the route to go, but I was just trying to highlight the use case versus the underlying tech here.

defaultExample: {
image: 'color-picker-default.png',
description:
'Let users visually select colors with an interactive picker. This example shows a basic color picker with hue and saturation controls.',
Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed that color picker has far fewer examples than other components. Is it worthwhile adding another example or two? Are there other use cases we haven't illustrated?

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.

Hey! Nice work on this. Left some comments.

There are some definite code issues to look at though.

Code review (.html + .jsx example files)

Avatar

default.html vs basic-usage.html: Near-identical examples. default.html shows initials="JD" alt="John Doe", basic-usage.html shows initials="SC" alt="Sarah Chen". Same pattern, same props, different names. One should be removed.

in-customer-list-context.html: Uses relative paths src="/customers/merchant-alice.jpg" and src="/customers/charlie-cafe.jpg". These will never render in a sandboxed extension environment. Should use CDN URLs (e.g., https://cdn.shopify.com/...) or remove the src to show initials-only fallback.

with-image-source-and-fallback.html: Uses relative path src="/customers/profile-123.jpg". The "fallback" behavior can't be demonstrated since the image will always fail.

with-section-component.html: Uses relative path src="/merchants/premium-store.jpg". Same issue.

color-consistency-demo.html: Contains HTML comment <!-- Note: Both AB avatars will have the same color -->. The behavior should be described in the doc.ts description, not inline.

Example count (9): High for a component with 3 props (initials, alt, src, size). Consider merging default.html + basic-usage.html, and possibly size-variations.html + long-initials-handling.html.

ColorField

default.html: Has both placeholder="Select a color (e.g., #FF0000)" and value="#FF0000". The placeholder is invisible when a value is present. these props are contradictory.

**default.html:**Mmissin a label prop. All other ColorField examples have labels. The default example should demonstrate best practices.

basic-usage-web-component.html vs basic-usage-required.html: Nearly identical. Same label="Brand color", same value="#FF0000". One adds name="color", the other adds required. These could be a single example with both name and required.

form-integration.html: Uses both value and defaultValue on the same field (value="#1a73e8" defaultValue="#1a73e8"). In React-style components, value is controlled and defaultValue is uncontrolled . I think using both is a bit backwardss. Should use one or the other.

validation-example.jsx: Uses onInput event. Verify this is a valid event for s-color-field (batch1 had the same question for s-money-field). Also uses e.currentTarget.value to read the field value.

ColorPicker

with-alpha-transparency.html: Wrapped in s-box with border/padding styling. Unnecessary wrapper for this example. It adds visual noise, without doin' much.

Icon

default.html vs basic-usage.html: Near-identical. Both show inline icon rows. default.html has home, order, product, settings. basic-usage.html has home, edit, duplicate, save, export. Same pattern, different icon sets. One should be removed.

with-id-property.html: <s-icon type="settings" id="settings-icon"></s-icon>. The id attribute is a generic HTML capability, really applies to a lot of stuff. You can add id to any element. This doesn't demonstrate any Icon-specific functionality.

in-button-components.html: Shows <s-button icon="plus">. This uses the Button's icon prop, not the s-icon component. While it shows icons in context, it doesn't demonstrate s-icon usage.

in-badge-components.html: Same issue -- shows <s-badge icon="check-circle">, not s-icon.

defaultExample: {
image: 'avatar-default.png',
description:
'Identify users visually when no profile image is available. This example shows an avatar displaying initials derived from a name.',
Copy link
Contributor

Choose a reason for hiding this comment

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

  • "Identify users visually" is a little vague. Aall avatars identify users visually
  • "initials derived from a name" overstates it I think. Thehe code just has initials="JD", there's no derivation happening

{
description:
'Loads a customer profile image with automatic fallback to initials if the image fails to load.',
'Display profile photos with graceful error handling. This example shows an avatar with a source image that falls back to initials if the image fails to load.',
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
'Display profile photos with graceful error handling. This example shows an avatar with a source image that falls back to initials if the image fails to load.',
'Display profile photos with error handling. This example shows an avatar with a source image that falls back to initials if the image fails to load.',

Copy link
Contributor

Choose a reason for hiding this comment

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

Wasn't sure what graceful error handlin' was. Either you handle it or don't. 😄 Could say something like: Show an image that falls back to initials when the image fails to load.

  • The example uses a relative path (/customers/profile-123.jpg) so the "fallback" is all you'll ever see. Is this URL correct?

{
description:
'Displays customer and merchant avatars in different sizes for various interface contexts.',
'Adapt avatar prominence to different UI contexts. This example shows all five available sizes from `small-200` to `large-200`.',
Copy link
Contributor

Choose a reason for hiding this comment

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

  • "prominence" and "UI contexts" feels like vague marketing-y language. Can we be more specific to what the example is doing?

{
description:
'Demonstrates that identical initials always receive the same color assignment across different store types.',
'Ensure visual consistency across the interface. This example shows that avatars with identical initials always display the same background color.',
Copy link
Contributor

Choose a reason for hiding this comment

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

'visual consistency' could mean a lot of different things here. The second sentence is 🔥

defaultExample: {
image: 'color-field-default.png',
description:
'Let users select colors using a visual picker or text input. This example shows a color field with a placeholder and pre-selected hex value.',
Copy link
Contributor

Choose a reason for hiding this comment

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

"This example shows a color field with a placeholder and pre-selected hex value."
It's advertising both props as the point of the example, but only one of them is ever visible at a time. A dev would look at the rendered preview, see #FF0000 in the field, and wonder where the placeholder is that the description mentions.

Example behind this: The HTML is:

<s-color-field placeholder="Select a color (e.g., #FF0000)" value="#FF0000"></s-color-field>

When a value is set, the placeholder is never reall visible. The browser/component renders the value instead. So placeholder="Select a color (e.g., #FF0000)" is dead code. The developer copying this example would never see the placeholder unless they delete the value first.

It's also missing a label prop. Every other ColorField example has a label.

Would need to do something like:

<s-color-field
  label="Brand color"
  value="#FF0000"
></s-color-field>

With no placeholder. Or with it:

<s-color-field
  label="Brand color"
  placeholder="e.g., #FF0000"
></s-color-field>

{
description:
'Interactive example showing real-time hex color validation with error messages.',
'Provide immediate feedback on color format validity. This example shows real-time validation that checks hex format as the user types.',
Copy link
Contributor

Choose a reason for hiding this comment

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

I see quite a few descriptions that say "Provide immediate feedback". I think we could be more specific on what feedback, or how it renders.

'Provide immediate feedback on color format validity. This example shows real-time validation that checks hex format as the user types.',
codeblock: {
title: 'Color validation',
title: 'Validate in real time',
Copy link
Contributor

Choose a reason for hiding this comment

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

Validate what? But we don't want to make the title too long.

defaultExample: {
image: 'color-picker-default.png',
description:
'Let users visually select colors with an interactive picker. This example shows a basic color picker with hue and saturation controls.',
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we're actually letting someone do something here. This also feels like it's just restating what ColorPicker is.

{
description:
'Compact icon sizing for space-constrained interfaces and inline usage. Shows how to render a small-sized icon that takes up minimal space while maintaining clarity.',
'Fit icons into tight layouts without losing clarity. This example shows a small-sized icon that takes up minimal space.',
Copy link
Contributor

Choose a reason for hiding this comment

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

"without losing clarity" feels a bit marketing-y. Clarity of what? nothing in the code demonstrates "clarity", really.

{
description:
'Icon with unique identifier for JavaScript targeting and styling. Demonstrates adding a specific ID to an icon, which can be used for JavaScript interactions, CSS styling, or accessibility purposes.',
'Enable programmatic access to specific icons. This example shows an icon with an ID attribute for JavaScript targeting or CSS styling.',
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a big thing, but maybe the example needs to be improved. This describes adding an HTML id attribute, which is a generic HTML capability, not Icon-specific.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants