Skip to main content

Migrate Link from Polaris React

Replace Polaris React Link with s-link. Keep a real href so browser navigation, modified clicks, copying, and link announcements continue to work.


Migrating links in content

<s-text>Review the <s-link href="/app/products">products requiring attention</s-link>.</s-text>
import {Link, Text} from '@shopify/polaris';

<Text as="p">
Review the <Link url="/app/products">products requiring attention</Link>.
</Text>

Preview


Polaris ReactPolaris web componentsMigration notes
urlhrefPreserve internal query strings and fragments.
externaltarget="_blank" when the destination leaves the embedded appDon't open internal app routes in a new tab.
downloaddownloadKeep href and verify response headers and filename.
onClickonClick only for navigation-related instrumentation or guardsDon't replace href with a client-side click handler.
accessibilityLabelaccessibilityLabel only when visible text is insufficientPrefer descriptive visible link text.
monochrome and removeUnderlineRemoveLet context and the destination component own link appearance.
dataPrimaryLinkPut the explicit resource link in the primary contentDon't make an entire row ambiguously clickable.

Use s-button when the control mutates data, submits, or changes local UI without navigating. Text such as Click here or Learn more needs surrounding context to be meaningful; prefer link text that names the destination.

For navigation inside an embedded app, keep the app route in href and verify App Bridge routing, browser history, and unsaved-change protection. Before programmatic navigation with dirty state, use the Save Bar API's leave confirmation.


  • Open internal links normally and with modified or middle clicks.
  • Verify external links and downloads use the intended target and response.
  • Use browser back and forward navigation inside the embedded app.
  • Check link purpose out of context with a screen reader.
  • Confirm unsaved forms block or allow navigation according to product rules.

Anchor to Remove Polaris ReactRemove Polaris React

Remove Link, client-router adapters used only by Polaris, and click handlers that duplicated native navigation. Remove @shopify/polaris only after no other route in scope imports it.



Was this page helpful?