Skip to main content

Migrate Link to the Polaris link component

The Polaris link component makes text interactive for navigation and link-triggered actions. It replaces the previous Link component and is available as <s-link> in API versions 2025-10 and newer.


The following properties are different in the Polaris link component.

The previous Link to prop is now called href.

target defaults to 'auto', which automatically opens external links in a new window so customers stay on the current page — no extra code needed. Set target="_blank" only when you want to force an internal link to open in a new window.

The previous Link language prop is now called lang.

The previous Link appearance prop is now called tone.

Previous valueNew valueMigration notes
'monochrome'Removedmonochrome is no longer available and doesn't have a direct replacement.
N/A'auto'auto is a new tone value. The link color is contextualized based on where it's rendered, and it might appear monochrome in subdued text.
N/A'neutral'

Migrating appearance to tone

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

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

function Extension() {
return (
<s-link href="/terms" tone="auto">
Terms and conditions
</s-link>
);
}
import {
reactExtension,
Link,
} from '@shopify/ui-extensions-react/checkout';

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

function Extension() {
return (
<Link to="/terms" appearance="monochrome">
Terms and conditions
</Link>
);
}

The previous Link onPress prop is now called onClick.

Migrating onPress to onClick

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

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

function Extension() {
return <s-link onClick={() => console.log('Clicked')}>Learn more</s-link>;
}
import {
reactExtension,
Link,
} from '@shopify/ui-extensions-react/checkout';

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

function Extension() {
return <Link onPress={() => console.log('Clicked')}>Learn more</Link>;
}

The previous Link external prop has been replaced with target.

Previous patternNew pattern
external={true}target="_blank"
external={false} or omittedtarget="auto" or omitted

The Polaris link component introduces the following new properties:

New propTypeDescription
command'--auto', '--toggle', '--copy', '--show', '--hide'Sets the action to run when the link is activated.
commandForstringSets the ID of the target component for the command.
interestForstringSets the ID of the component that should respond to hover and focus.
target'_blank' | 'auto'Controls where the link opens.

Anchor to activateAction and activateTargetactivateAction and activateTarget

The previous Link activateAction and activateTarget props have been replaced with command and commandFor.

Previous patternNew patternMigration notes
activateAction="copy" + activateTarget="promo-code"command="--copy" + commandFor="promo-code"Copy behavior now uses the command pattern.

Migrating activateAction to command

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

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

function Extension() {
return (
<>
<s-link command="--copy" commandFor="promo-code">
Copy promo code
</s-link>
<s-clipboard-item id="promo-code" text="SAVE20"></s-clipboard-item>
</>
);
}
import {
ClipboardItem,
reactExtension,
Link,
} from '@shopify/ui-extensions-react/checkout';

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

function Extension() {
return (
<>
<Link activateAction="copy" activateTarget="promo-code">
Copy promo code
</Link>
<ClipboardItem id="promo-code" text="SAVE20" />
</>
);
}

The Polaris link component no longer supports overlay directly. To open a modal overlay, use commandFor with command and target s-modal.

Migrating overlay to commandFor

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

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

function Extension() {
return (
<>
<s-link command="--show" commandFor="details-modal">
View details
</s-link>
<s-modal id="details-modal" heading="Order details">
<s-text>Your order includes free shipping on all items.</s-text>
</s-modal>
</>
);
}
import {
Link,
Modal,
Text,
reactExtension,
} from '@shopify/ui-extensions-react/checkout';

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

function Extension() {
return (
<Link
overlay={
<Modal title="Order details">
<Text>Your order includes free shipping on all items.</Text>
</Modal>
}
>
View details
</Link>
);
}

The previous Link toggles prop was used to expand or collapse content in Disclosure. In Polaris, use s-details with s-summary for expandable content instead of a link trigger.

Previous valueNew pattern
toggles="shipping-details"Use <s-details> with <s-summary> and place the expandable content inside.

Migrating toggles to details

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

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

function Extension() {
return (
<s-details>
<s-summary>View shipping details</s-summary>
<s-text>Ships within 3 to 5 business days.</s-text>
</s-details>
);
}
import {
reactExtension,
Disclosure,
Link,
Text,
View,
} from '@shopify/ui-extensions-react/checkout';

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

function Extension() {
return (
<Disclosure>
<Link toggles="shipping-details">View shipping details</Link>
<View id="shipping-details">
<Text>Ships within 3 to 5 business days.</Text>
</View>
</Disclosure>
);
}

Was this page helpful?