PPolaris ComponentsConnect an agent

Link

A text link that takes someone to another page, either inside the app or out to an external site, and can be styled inline, monochrome or without an underline.

Preview

Code

Example.jsx
import { Card, BlockStack, InlineStack, Text, Link, Banner } from '@shopify/polaris';

const HELP_CENTER_URL = 'https://help.shopify.com/manual/discounts';
const SHIPPING_URL = 'https://help.shopify.com/manual/shipping';
const ORDER_URL = 'https://example.com/admin/orders/1054';

export const Example = () => (
  <BlockStack gap="400">
    <Card>
      <BlockStack gap="300">
        <Text as="h2" variant="headingMd">
          Inline in a sentence
        </Text>
        <Text as="p">
          Discounts apply at checkout once the customer meets the conditions you set. Read more about{' '}
          <Link url={HELP_CENTER_URL} target="_blank">
            how discount codes work
          </Link>{' '}
          before you publish this campaign.
        </Text>
      </BlockStack>
    </Card>

    <Card>
      <BlockStack gap="300">
        <Text as="h2" variant="headingMd">
          Variations
        </Text>
        <InlineStack gap="400" blockAlign="center">
          <Link url={ORDER_URL}>Order #1054</Link>
          <Link url={SHIPPING_URL} target="_blank">
            Shipping settings
          </Link>
          <Link url={HELP_CENTER_URL} removeUnderline>
            No underline
          </Link>
          <Link onClick={() => {}}>Button-like link</Link>
        </InlineStack>
        <Text as="p" tone="subdued">
          A monochrome link inherits the colour of the text around it, so it stays legible on a tinted
          surface such as a{' '}
          <Link url={SHIPPING_URL} monochrome removeUnderline>
            banner or table cell
          </Link>
          .
        </Text>
      </BlockStack>
    </Card>

    <Banner title="Payouts are on hold" tone="warning">
      <Text as="p">
        Confirm your bank details to resume payouts. See{' '}
        <Link url={HELP_CENTER_URL} monochrome>
          why this happens
        </Link>
        .
      </Text>
    </Banner>
  </BlockStack>
);