--- title: Link description: >- Makes text interactive, allowing users to navigate to other pages or perform specific actions. Supports standard URLs, custom protocols, and navigation within Shopify or app pages. api_name: app-home source_url: html: 'https://shopify.dev/docs/api/app-home/polaris-web-components/actions/link' md: 'https://shopify.dev/docs/api/app-home/polaris-web-components/actions/link.md' --- # Link Makes text interactive, allowing users to navigate to other pages or perform specific actions. Supports standard URLs, custom protocols, and navigation within Shopify or app pages. ## Properties * accessibilityLabel string A label that describes the purpose or contents of the Link. It will be read to users using assistive technologies such as screen readers. Use this when using only an icon or the content of the link is not enough context for users using assistive technologies. * command '--auto' | '--show' | '--hide' | '--toggle' Default: '--auto' Sets the action the [command](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#command) should take when this clickable is activated. See the documentation of particular components for the actions they support. * `--auto`: a default action for the target component. * `--show`: shows the target component. * `--hide`: hides the target component. * `--toggle`: toggles the target component. * commandFor string Sets the element the [commandFor](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#commandfor) should act on when this clickable is activated. * download string Causes the browser to treat the linked URL as a download with the string being the file name. Download only works for same-origin URLs or the `blob:` and `data:` schemes. * href string The URL to link to. * If set, it will navigate to the location specified by `href` after executing the `click` event. * If a `commandFor` is set, the `command` will be executed instead of the navigation. * interestFor string Sets the element the [interestFor](https://open-ui.org/components/interest-invokers.explainer/#the-pitch-in-code) should act on when this clickable is activated. * lang string Indicate the text language. Useful when the text is in a different language than the rest of the page. It will allow assistive technologies such as screen readers to invoke the correct pronunciation. [Reference of values](https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry) ("subtag" label) * target "auto" | AnyString | "\_blank" | "\_self" | "\_parent" | "\_top" Default: 'auto' Specifies where to display the linked URL. * tone "critical" | "auto" | "neutral" Default: 'auto' Sets the tone of the Link, based on the intention of the information being conveyed. ### AnyString Prevents widening string literal types in a union to \`string\`. ```ts string & {} ``` ## Events Learn more about [registering events](https://shopify.dev/docs/api/app-home/using-polaris-components#event-handling). * click CallbackEventListener\ | null ### CallbackEventListener ```ts (EventListener & { (event: CallbackEvent): void; }) | null ``` ### CallbackEvent ```ts Event & { currentTarget: HTMLElementTagNameMap[T]; } ``` ## Slots * children HTMLElement The content of the Link. ### Examples * #### Code ##### jsx ```jsx fufilling orders ``` ##### html ```html fufilling orders ``` ## Examples Component examples ### Basic usage Basic Links in Paragraph Links automatically inherit the tone from their surrounding paragraph context. Links in Subdued Paragraph Demonstrates links within subdued paragraph, showing how links can be used in less prominent paragraph contexts for additional guidance or support. Critical Context Links Illustrates how links can be used in critical or urgent text contexts, drawing attention to important actions that require immediate user intervention. Links with Auto Tone Shows how links automatically adapt their tone to the surrounding text context, maintaining visual consistency while providing navigation. Links in Banner Demonstrates how links can be integrated within banner components to highlight important information and provide direct action paths. Links in Box Container Illustrates using links within a box container to provide contextual navigation and additional information in a visually contained area. Links in Banner Context Shows how links can be used within warning banners to provide immediate actions related to critical notifications. Download Links Demonstrates how to create links that trigger file downloads, useful for exporting data or providing downloadable resources. External Links Illustrates linking to external resources with different targets, showing how to open links in new tabs and provide navigation to external documentation. Links with Language Attribute Shows how to use the `lang` attribute to specify the language of a link, supporting internationalization and proper screen reader pronunciation. Links with Different Tones Demonstrates how links can have different visual tones, including default, neutral, and critical, allowing for varied contextual styling. ### Examples * #### Basic Links in Paragraph ##### Description Links automatically inherit the tone from their surrounding paragraph context. ##### jsx ```jsx Your product catalog is empty. Start by adding your first product or importing existing inventory. ``` ##### html ```html Your product catalog is empty. Start by adding your first product or importing existing inventory. ``` * #### Links in Subdued Paragraph ##### Description Demonstrates links within subdued paragraph, showing how links can be used in less prominent paragraph contexts for additional guidance or support. ##### jsx ```jsx Need help setting up shipping rates? View shipping guide or contact merchant support. ``` ##### html ```html Need help setting up shipping rates? View shipping guide or contact merchant support. ``` * #### Critical Context Links ##### Description Illustrates how links can be used in critical or urgent text contexts, drawing attention to important actions that require immediate user intervention. ##### jsx ```jsx Your store will be suspended in 24 hours due to unpaid balance. Update payment method to avoid service interruption. ``` ##### html ```html Your store will be suspended in 24 hours due to unpaid balance. Update payment method to avoid service interruption. ``` * #### Links with Auto Tone ##### Description Shows how links automatically adapt their tone to the surrounding text context, maintaining visual consistency while providing navigation. ##### jsx ```jsx You have 15 pending orders to fulfill. Review unfulfilled orders to keep customers happy. ``` ##### html ```html You have 15 pending orders to fulfill. Review unfulfilled orders to keep customers happy. ``` * #### Links in Banner ##### Description Demonstrates how links can be integrated within banner components to highlight important information and provide direct action paths. ##### jsx ```jsx Black Friday campaigns are now available! Create your campaign ``` ##### html ```html Black Friday campaigns are now available! Create your campaign ``` * #### Links in Box Container ##### Description Illustrates using links within a box container to provide contextual navigation and additional information in a visually contained area. ##### jsx ```jsx Boost your store's conversion with professional themes. Browse theme store or customize your current theme. ``` ##### html ```html Boost your store's conversion with professional themes. Browse theme store or customize your current theme. ``` * #### Links in Banner Context ##### Description Shows how links can be used within warning banners to provide immediate actions related to critical notifications. ##### jsx ```jsx Your inventory for "Vintage t-shirt" is running low (3 remaining). Restock inventory ``` ##### html ```html Your inventory for "Vintage t-shirt" is running low (3 remaining). Restock inventory ``` * #### Download Links ##### Description Demonstrates how to create links that trigger file downloads, useful for exporting data or providing downloadable resources. ##### jsx ```jsx Export your customer data for marketing analysis. Download customer list ``` ##### html ```html Export your customer data for marketing analysis. Download customer list ``` * #### External Links ##### Description Illustrates linking to external resources with different targets, showing how to open links in new tabs and provide navigation to external documentation. ##### jsx ```jsx Need help with policies? Read our billing docs or review the terms of service. ``` ##### html ```html Need help with policies? Read our billing docs or review the terms of service. ``` * #### Links with Language Attribute ##### Description Shows how to use the \`lang\` attribute to specify the language of a link, supporting internationalization and proper screen reader pronunciation. ##### jsx ```jsx Voir en français: Gérer les produits ``` ##### html ```html Voir en français: Gérer les produits ``` * #### Links with Different Tones ##### Description Demonstrates how links can have different visual tones, including default, neutral, and critical, allowing for varied contextual styling. ##### jsx ```jsx Default tone: View orders Success tone: Inventory help Critical tone: Close store Warning tone: Update billing info Info tone: Learn more about reports Caution tone: View archived products ``` ##### html ```html Default tone: View orders Neutral tone: Inventory help Critical tone: Close store Warning tone: Update billing info Info tone: Learn more about reports Subdued tone: View archived products ```