Skip to main content

Migrate to the Polaris text component

The Polaris text component renders inline text with semantic meaning and styling. It replaces the previous Text component and is available as <s-text> in API versions 2025-10 and newer.


The following properties are different in the Polaris text component.

The previous Text emphasis prop is now called type.

Previous valueNew valueMigration notes
'bold'type="strong"Use type="strong".
'italic'type="offset"Use type="offset".

Migrating emphasis to type

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

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

function Extension() {
return <s-text type="strong">Total: $99.99</s-text>;
}
import {
reactExtension,
Text,
} from '@shopify/ui-extensions-react/checkout';

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

function Extension() {
return <Text emphasis="bold">Total: $99.99</Text>;
}

The previous Text accessibilityRole prop has been replaced with type for string roles, and separate components for object roles.

String roles:

Previous roleNew pattern
'address'type="address"
'deletion'type="redundant"
'marking'type="mark"
'offset'type="offset"
'stress'type="offset"
'strong'type="strong"

Object roles:

Previous patternNew pattern
accessibilityRole={{type: 'abbreviation', for: '...'}}Use <s-abbreviation title="...">
accessibilityRole={{type: 'datetime', machineReadable: '...'}}Use <s-time dateTime="...">
accessibilityRole={{type: 'directional-override', direction: '...'}}Use dir prop on <s-text>

Migrating accessibilityRole (string)

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

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

function Extension() {
return (
<s-text type="address">
123 Main St, Toronto, ON
</s-text>
);
}
import {
reactExtension,
Text,
} from '@shopify/ui-extensions-react/checkout';

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

function Extension() {
return (
<Text accessibilityRole="address">
123 Main St, Toronto, ON
</Text>
);
}

Migrating accessibilityRole (object)

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

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

function Extension() {
return (
<>
<s-abbreviation title="Hypertext Markup Language">
HTML
</s-abbreviation>
<s-time dateTime="2024-01-15">January 15, 2024</s-time>
<s-text dir="rtl">שלום</s-text>
</>
);
}
import {
reactExtension,
Text,
} from '@shopify/ui-extensions-react/checkout';

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

function Extension() {
return (
<>
<Text
accessibilityRole={{
type: 'abbreviation',
for: 'Hypertext Markup Language',
}}
>
HTML
</Text>
<Text
accessibilityRole={{
type: 'datetime',
machineReadable: '2024-01-15',
}}
>
January 15, 2024
</Text>
<Text
accessibilityRole={{
type: 'directional-override',
direction: 'rtl',
}}
>
שלום
</Text>
</>
);
}

The previous visibility="hidden" is now accessibilityVisibility="exclusive".

Previous patternNew pattern
visibility="hidden"accessibilityVisibility="exclusive"

The Polaris text component no longer supports appearance. Use color and tone instead.

Previous valueNew patternMigration notes
'subdued'color="subdued"Use color prop.
'info'tone="info"Use tone prop.
'success'tone="success"Use tone prop.
'warning'tone="warning"Use tone prop.
'critical'tone="critical"Use tone prop.
'decorative'tone="custom"Use tone="custom".
'accent'tone="auto"Use tone="auto".

Migrating appearance to color and tone

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

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

function Extension() {
return (
<>
<s-text color="subdued">Optional</s-text>
<s-text tone="critical">Payment failed</s-text>
</>
);
}
import {
reactExtension,
Text,
} from '@shopify/ui-extensions-react/checkout';

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

function Extension() {
return (
<>
<Text appearance="subdued">Optional</Text>
<Text appearance="critical">Payment failed</Text>
</>
);
}

The Polaris text component no longer supports size. Use type="small" for small text, or <s-heading> for larger text.


The Polaris text component introduces the following new properties:

New propTypeDescription
color'subdued' | 'base'Text color.
dir'ltr' | 'rtl' | 'auto'Text direction.
display'auto' | 'none'Controls element visibility.
langstringLanguage of the text content.
tone'auto' | 'info' | 'success' | 'warning' | 'critical' | 'custom'Semantic tone.

Was this page helpful?