Skip to main content

Migrate to the Polaris badge component

The Polaris badge component displays status information or indicates completed actions through compact visual indicators. It replaces the previous Badge component and is available as <s-badge> in API versions 2025-10 and newer.


The following properties are different in the Polaris badge component.

Update tone values as follows:

Previous valueNew value
'critical''critical'
'default''auto'
'subdued''auto' + color="subdued"

Migrating tone values

import '@shopify/ui-extensions/preact';
import {render} from 'preact';

export default function extension() {
render(<Extension />, document.body);
}

function Extension() {
return <s-badge color="subdued">Low stock</s-badge>;
}
import {
reactExtension,
Badge,
} from '@shopify/ui-extensions-react/checkout';

export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);

function Extension() {
return <Badge tone="subdued">Low stock</Badge>;
}

The size property adds a new option:

Previous valueNew valueMigration notes
'small''small' or 'small-100''small' is an alias for 'small-100'.
'base''base'No change is needed.

For more on the scale system, see Scale.

If you use the icon property, then update icon names to their Polaris web component equivalents. Badge uses the same icon names as the Polaris icon component.

Note

This table lists only icon values that need more than a camelCase-to-kebab-case rename. If an icon isn't listed here, then convert its previous camelCase name to kebab-case. For example, arrowLeft becomes arrow-left.

Previous iconNew icon
'checkmark''check'
'close''x'
'critical''alert-circle'
'error''x-circle'
'errorFill''x-circle-filled'
'gift''gift-card'
'giftFill''gift-card'
'hamburger''menu'
'hollowCircle''circle'
'horizontalDots''menu-horizontal'
'infoFill''info-filled'
'list''list-bulleted'
'magnify''search'
'marker''location'
'orderBox''order'
'pen''edit'
'question''question-circle'
'questionFill''question-circle-filled'
'starFill''star-filled'
'success''check-circle'
'verticalDots''menu-vertical'
'warning''alert-triangle'
'warningFill''alert-triangle-filled'

Migrating icon values

import '@shopify/ui-extensions/preact';
import {render} from 'preact';

export default function extension() {
render(<Extension />, document.body);
}

function Extension() {
return <s-badge icon="check">Fulfilled</s-badge>;
}
import {
reactExtension,
Badge,
} from '@shopify/ui-extensions-react/checkout';

export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);

function Extension() {
return <Badge icon="checkmark">Fulfilled</Badge>;
}

The Polaris badge component no longer supports accessibilityLabel directly. To provide an accessibility label, wrap the badge in s-box and set accessibilityLabel on the box.

Migrating accessibilityLabel

import '@shopify/ui-extensions/preact';
import {render} from 'preact';

export default function extension() {
render(<Extension />, document.body);
}

function Extension() {
return (
<s-box accessibilityLabel="Order fulfilled">
<s-badge>Fulfilled</s-badge>
</s-box>
);
}
import {
reactExtension,
Badge,
} from '@shopify/ui-extensions-react/checkout';

export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);

function Extension() {
return <Badge accessibilityLabel="Order fulfilled">Fulfilled</Badge>;
}

Anchor to accessibilityVisibilityaccessibilityVisibility

The Polaris badge component no longer supports accessibilityVisibility directly. To control accessibility visibility, wrap the badge in s-box and set accessibilityVisibility on the box.

Use these values as needed:

  • visible: the element is visible to all users.
  • hidden: the element is removed from the accessibility tree but remains visible.
  • exclusive: the element is visually hidden but remains in the accessibility tree.

Migrating accessibilityVisibility

import '@shopify/ui-extensions/preact';
import {render} from 'preact';

export default function extension() {
render(<Extension />, document.body);
}

function Extension() {
return (
<s-box accessibilityVisibility="hidden">
<s-badge>Fulfilled</s-badge>
</s-box>
);
}
import {
reactExtension,
Badge,
} from '@shopify/ui-extensions-react/checkout';

export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);

function Extension() {
return <Badge accessibilityVisibility="hidden">Fulfilled</Badge>;
}

The Polaris badge component no longer supports visibility directly. If you need to visually hide the badge while keeping it in the accessibility tree, wrap the badge in s-box and set accessibilityVisibility="exclusive" on the box.

Migrating visibility

import '@shopify/ui-extensions/preact';
import {render} from 'preact';

export default function extension() {
render(<Extension />, document.body);
}

function Extension() {
return (
<s-box accessibilityVisibility="exclusive">
<s-badge>Fulfilled</s-badge>
</s-box>
);
}
import {
reactExtension,
Badge,
} from '@shopify/ui-extensions-react/checkout';

export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);

function Extension() {
return <Badge visibility="hidden">Fulfilled</Badge>;
}

The Polaris badge component introduces the following new properties:

Use the color property to control the intensity of the badge.

ValueDescription
'base'Uses the default badge color intensity.
'subdued'Uses a softer badge color intensity.
Note

Set color="subdued" with tone="auto" to match the previous tone="subdued" appearance.


Was this page helpful?