Skip to main content

Migrate Text from Polaris React

Choose s-heading, s-paragraph, or s-text from the content's semantics, not the old visual variant. Preserve heading order and readable paragraph structure.


Anchor to Choose the destinationChoose the destination

Polaris ReactPolaris web componentsMigration type
Texts-text, s-paragraph, or s-heading, based on semanticsDirect

Polaris ReactPolaris web componentsMigration notes
as="h1" through as="h6"s-page heading, s-section heading, or s-headingThe destination has no level property. Heading level is determined automatically by page and section nesting, so rebuild the semantic section hierarchy instead of copying h1–h6 values.
as="p" or inline as="span"s-paragraph or s-textChoose paragraph or inline semantics from the content.
Strong variants, tone, and truncatetype="strong", supported tone or color, and lineClamp where availableMap by meaning and keep required content accessible.

Anchor to Migrate the call siteMigrate the call site

  1. Inventory every Text call site and record the content, state, events, and accessibility behavior it uses.

  2. Open the linked Polaris web component reference and map only documented properties, slots, and events.

  3. Move unsupported responsibilities into adjacent content or app state instead of passing old props through.

  4. After verification, remove the Text import and any Polaris-only state, wrappers, or helpers that no longer have a caller.

Prefer the heading property on s-page or s-section when the text names that region. Use s-heading for a heading in a custom layout, nested in the section whose content it introduces. Don't use visual placement alone to imply a heading level.


Anchor to Preserve these behaviorsPreserve these behaviors

  • Accessible names, semantics, and keyboard behavior.
  • Visible content plus disabled, loading, selected, or error state that affects the task.
  • Click, change, submit, and navigation behavior used by app logic.

Anchor to Test and remove Polaris ReactTest and remove Polaris React

Test every migrated Text state used by the app. For interactive destinations, verify keyboard operation, focus, and accessible naming. For content destinations, verify document structure and alternative text where applicable. Compare behavior rather than pixel-for-pixel styling.

Don't remove @shopify/polaris while another component still imports it. Once all call sites are migrated, remove the package and its provider-level setup, then run the app's full test suite.


Migrating Text

export function TextMigrationExample() {
return (
<><s-paragraph color="subdued">Product description</s-paragraph></>
);
}
import {Text} from '@shopify/polaris';


export function TextMigrationExample() {

return (
<Text as="p" variant="bodyMd" tone="subdued">Product description</Text>
);
}

Preview


Was this page helpful?