---
title: "Share Links"
description: "Provides sharing actions for the current content - share-intent links, email, copy link and the native share sheet, as a row, labeled, or a vertical rail."
slug: "share-links"
---

import { DocPage, PageHeader, SkillPanel, SourceFiles, DocLink, SkillField, SkillText, SkillRow, ApiPill } from "../../lib/components/index";

<DocPage meta={meta}>

<PageHeader slug="share-links" title="Share Links" component="share-links">
  Provides sharing actions for the current content - share-intent links, email, copy link and the native share sheet, as a row, labeled, or a vertical rail. Part of the <DocLink href="website-article.html">Article</DocLink> blocks.
</PageHeader>

<SkillPanel component="share-links">
  <SkillField label="Native basis">
<SkillText>A labelled group of Buttons: share-intent <code>&lt;a href&gt;</code> links (X, LinkedIn - no third-party script, no tracking), <code>mailto:</code>, and buttons the page wires to <code>navigator.clipboard</code> and <code>navigator.share</code>.</SkillText>
  </SkillField>

  <SkillField label="Built from">
<SkillText><DocLink href="button.html">Button</DocLink>, <DocLink href="popover.html">Popover</DocLink>, <DocLink href="input.html">Input</DocLink>, <DocLink href="toast.html">Toast</DocLink>.</SkillText>
  </SkillField>

  <SkillField label="Web Platform APIs">
<SkillRow>
    <ApiPill href="https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/writeText" title="copy link"><code>navigator.clipboard</code></ApiPill>
    <ApiPill href="https://developer.mozilla.org/en-US/docs/Web/API/Navigator/share" title="the native share sheet"><code>navigator.share()</code></ApiPill>
    <ApiPill href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/output" title="the copy confirmation"><code>&lt;output&gt;</code></ApiPill>
    <ApiPill href="https://developer.mozilla.org/en-US/docs/Web/CSS/writing-mode" title="the vertical label"><code>writing-mode</code></ApiPill>
  </SkillRow>
  </SkillField>

  <SkillField label="Classes">
<SkillRow>
    <code>.mk-share-links</code>
    <code>.mk-share-links-label</code>
    <code>.mk-share-links-list</code>
    <code>.mk-share-links-status</code>
    <code>.mk-share-links-url</code>
  </SkillRow>
  </SkillField>

  <SkillField label="Data attributes">
<SkillText><code>data-variant</code> (<code>labeled</code>, <code>vertical</code>); <code>.mk-share-links-status</code> (an <code>&lt;output&gt;</code>); <code>data-variant</code> (<code>brand</code> + <code>data-network</code> on the buttons, <code>pill</code>); <code>.mk-share-links-url</code> (a share popover's URL field).</SkillText>
  </SkillField>
</SkillPanel>

```html example label="Default" hint="Icon Buttons: X and LinkedIn are plain share-intent links (no third-party script, no tracking), email is mailto:, copy link is a button this page wires to navigator.clipboard (see the script) - the <output> confirms." previewStyle="align-items:stretch;"
<div class="mk-share-links" role="group" aria-label="Share this article">
  <span class="mk-share-links-label">Share</span>
  <ul class="mk-share-links-list">
    <li
      ><a
        class="btn"
        data-variant="outline"
        data-size="icon-sm"
        href="https://x.com/intent/post?url=https%3A%2F%2Fexample.com%2Fcalm-software&amp;text=Calm%20software"
        target="_blank"
        rel="noopener"
        aria-label="Share on X"
        ><svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true">
          <path
            d="M18.9 2H22l-6.8 7.8L23.2 22h-6.3l-4.9-6.4L6.4 22H3.3l7.3-8.3L.8 2h6.4l4.4 5.9L18.9 2Zm-1.1 18h1.7L6.3 3.9H4.5L17.8 20Z"
          /></svg></a
    ></li>
    <li
      ><a
        class="btn"
        data-variant="outline"
        data-size="icon-sm"
        href="https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fexample.com%2Fcalm-software"
        target="_blank"
        rel="noopener"
        aria-label="Share on LinkedIn"
        ><svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true">
          <path
            d="M5 3.5A2.5 2.5 0 1 1 5 8.5 2.5 2.5 0 0 1 5 3.5ZM3 10h4v11H3V10Zm7 0h3.8v1.6h.1c.5-1 1.8-1.9 3.6-1.9 3.9 0 4.5 2.5 4.5 5.8V21h-4v-4.9c0-1.2 0-2.7-1.7-2.7s-2 1.3-2 2.6v5h-4V10Z"
          /></svg></a
    ></li>
    <li
      ><a
        class="btn"
        data-variant="outline"
        data-size="icon-sm"
        href="mailto:?subject=Calm%20software&amp;body=https%3A%2F%2Fexample.com%2Fcalm-software"
        aria-label="Share by email"
        ><i data-lucide="mail"></i></a
    ></li>
    <li
      ><button
        type="button"
        class="btn"
        data-variant="outline"
        data-size="icon-sm"
        data-share="copy"
        aria-label="Copy link"
        ><i data-lucide="link"></i></button
    ></li>
  </ul>
  <output class="mk-share-links-status" id="share-status"></output>
</div>
<script>
  document.addEventListener('DOMContentLoaded', () => {
    df$('[data-share="copy"]').on('click', async () => {
      await navigator.clipboard?.writeText(location.href).catch(() => {});
      df$('#share-status').text('Link copied');
      setTimeout(() => df$('#share-status').text(''), 2000);
    });
  });
</script>
```

```html example label="Labeled with native share" hint="data-variant='labeled': the buttons say what they do. The Share button opens the system share sheet (navigator.share) - the script hides it where the API is missing." previewStyle="align-items:stretch;"
<div class="mk-share-links" data-variant="labeled" role="group" aria-label="Share this article">
  <span class="mk-share-links-label">Share</span>
  <ul class="mk-share-links-list">
    <li
      ><a
        class="btn"
        data-variant="outline"
        data-size="sm"
        href="https://x.com/intent/post?url=https%3A%2F%2Fexample.com%2Fcalm-software&amp;text=Calm%20software"
        target="_blank"
        rel="noopener"
        ><svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true">
          <path
            d="M18.9 2H22l-6.8 7.8L23.2 22h-6.3l-4.9-6.4L6.4 22H3.3l7.3-8.3L.8 2h6.4l4.4 5.9L18.9 2Zm-1.1 18h1.7L6.3 3.9H4.5L17.8 20Z"
          />
        </svg>
        Post</a
      ></li
    >
    <li
      ><a
        class="btn"
        data-variant="outline"
        data-size="sm"
        href="https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fexample.com%2Fcalm-software"
        target="_blank"
        rel="noopener"
        ><svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true">
          <path
            d="M5 3.5A2.5 2.5 0 1 1 5 8.5 2.5 2.5 0 0 1 5 3.5ZM3 10h4v11H3V10Zm7 0h3.8v1.6h.1c.5-1 1.8-1.9 3.6-1.9 3.9 0 4.5 2.5 4.5 5.8V21h-4v-4.9c0-1.2 0-2.7-1.7-2.7s-2 1.3-2 2.6v5h-4V10Z"
          />
        </svg>
        LinkedIn</a
      ></li
    >
    <li
      ><a
        class="btn"
        data-variant="outline"
        data-size="sm"
        href="mailto:?subject=Calm%20software&amp;body=https%3A%2F%2Fexample.com%2Fcalm-software"
        ><i data-lucide="mail"></i> Email</a
      ></li
    >
    <li
      ><button type="button" class="btn" data-variant="outline" data-size="sm" data-share="copy"
        ><i data-lucide="link"></i> Copy link</button
      ></li
    >
    <li
      ><button type="button" class="btn" data-size="sm" data-share="native"
        ><i data-lucide="share-2"></i> Share…</button
      ></li
    >
  </ul>
</div>
<script>
  document.addEventListener('DOMContentLoaded', () => {
    const native = df$('[data-share="native"]');
    if (!navigator.share) native.closest('li').attr('hidden', '');
    native.on('click', () => navigator.share({ title: document.title, url: location.href }).catch(() => {}));
  });
</script>
```

```html example label="Vertical rail" hint="data-variant='vertical': a column with a vertical label - give it position: sticky beside an article." previewStyle="align-items:stretch;"
<div class="mk-share-links" data-variant="vertical" role="group" aria-label="Share this article">
  <span class="mk-share-links-label">Share</span>
  <ul class="mk-share-links-list">
    <li
      ><a
        class="btn"
        data-variant="outline"
        data-size="icon-sm"
        href="https://x.com/intent/post?url=https%3A%2F%2Fexample.com%2Fcalm-software&amp;text=Calm%20software"
        target="_blank"
        rel="noopener"
        aria-label="Share on X"
        ><svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true">
          <path
            d="M18.9 2H22l-6.8 7.8L23.2 22h-6.3l-4.9-6.4L6.4 22H3.3l7.3-8.3L.8 2h6.4l4.4 5.9L18.9 2Zm-1.1 18h1.7L6.3 3.9H4.5L17.8 20Z"
          /></svg></a
    ></li>
    <li
      ><a
        class="btn"
        data-variant="outline"
        data-size="icon-sm"
        href="https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fexample.com%2Fcalm-software"
        target="_blank"
        rel="noopener"
        aria-label="Share on LinkedIn"
        ><svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true">
          <path
            d="M5 3.5A2.5 2.5 0 1 1 5 8.5 2.5 2.5 0 0 1 5 3.5ZM3 10h4v11H3V10Zm7 0h3.8v1.6h.1c.5-1 1.8-1.9 3.6-1.9 3.9 0 4.5 2.5 4.5 5.8V21h-4v-4.9c0-1.2 0-2.7-1.7-2.7s-2 1.3-2 2.6v5h-4V10Z"
          /></svg></a
    ></li>
    <li
      ><a
        class="btn"
        data-variant="outline"
        data-size="icon-sm"
        href="mailto:?subject=Calm%20software&amp;body=https%3A%2F%2Fexample.com%2Fcalm-software"
        aria-label="Share by email"
        ><i data-lucide="mail"></i></a
    ></li>
    <li
      ><button
        type="button"
        class="btn"
        data-variant="outline"
        data-size="icon-sm"
        data-share="copy"
        aria-label="Copy link"
        ><i data-lucide="link"></i></button
    ></li>
  </ul>
</div>
```

```html example label="Brand colours, copy with a toast" hint="data-variant='brand': each network in its own colour (data-network on the button). Copy link confirms with a Toast - df$.shadcn.toast.show()." previewStyle="align-items:stretch;"
<div class="mk-share-links" data-variant="brand" role="group" aria-label="Share this article">
  <span class="mk-share-links-label">Share</span>
  <ul class="mk-share-links-list">
    <li
      ><a
        class="btn"
        data-variant="outline"
        data-size="icon-sm"
        data-network="x"
        href="https://x.com/intent/post?url=https%3A%2F%2Fexample.com%2Fcalm-software&amp;text=Calm%20software"
        target="_blank"
        rel="noopener"
        aria-label="Share on X"
        ><svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true">
          <path
            d="M18.9 2H22l-6.8 7.8L23.2 22h-6.3l-4.9-6.4L6.4 22H3.3l7.3-8.3L.8 2h6.4l4.4 5.9L18.9 2Zm-1.1 18h1.7L6.3 3.9H4.5L17.8 20Z"
          /></svg></a
    ></li>
    <li
      ><a
        class="btn"
        data-variant="outline"
        data-size="icon-sm"
        data-network="linkedin"
        href="https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fexample.com%2Fcalm-software"
        target="_blank"
        rel="noopener"
        aria-label="Share on LinkedIn"
        ><svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true">
          <path
            d="M5 3.5A2.5 2.5 0 1 1 5 8.5 2.5 2.5 0 0 1 5 3.5ZM3 10h4v11H3V10Zm7 0h3.8v1.6h.1c.5-1 1.8-1.9 3.6-1.9 3.9 0 4.5 2.5 4.5 5.8V21h-4v-4.9c0-1.2 0-2.7-1.7-2.7s-2 1.3-2 2.6v5h-4V10Z"
          /></svg></a
    ></li>
    <li
      ><a
        class="btn"
        data-variant="outline"
        data-size="icon-sm"
        data-network="email"
        href="mailto:?subject=Calm%20software&amp;body=https%3A%2F%2Fexample.com%2Fcalm-software"
        aria-label="Share by email"
        ><i data-lucide="mail"></i></a
    ></li>
    <li
      ><button
        type="button"
        class="btn"
        data-variant="outline"
        data-size="icon-sm"
        data-share="copy"
        data-network="link"
        aria-label="Copy link"
        ><i data-lucide="link"></i></button
    ></li>
  </ul>
</div>
<script>
  document.addEventListener('DOMContentLoaded', () => {
    df$('[data-share="copy"]').on('click', async () => {
      await navigator.clipboard?.writeText(location.href).catch(() => {});
      df$.shadcn.toast.show({ title: 'Link copied', description: 'Paste it anywhere.' });
    });
  });
</script>
```

```html example label="Pill toolbar" hint="data-variant='pill': a floating rounded toolbar - pin it to the bottom of a long read with position: sticky." previewStyle="align-items:stretch;"
<div class="mk-share-links" data-variant="pill" role="group" aria-label="Share this article">
  <span class="mk-share-links-label">Share</span>
  <ul class="mk-share-links-list">
    <li
      ><a
        class="btn"
        data-variant="outline"
        data-size="icon-sm"
        href="https://x.com/intent/post?url=https%3A%2F%2Fexample.com%2Fcalm-software&amp;text=Calm%20software"
        target="_blank"
        rel="noopener"
        aria-label="Share on X"
        ><svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true">
          <path
            d="M18.9 2H22l-6.8 7.8L23.2 22h-6.3l-4.9-6.4L6.4 22H3.3l7.3-8.3L.8 2h6.4l4.4 5.9L18.9 2Zm-1.1 18h1.7L6.3 3.9H4.5L17.8 20Z"
          /></svg></a
    ></li>
    <li
      ><a
        class="btn"
        data-variant="outline"
        data-size="icon-sm"
        href="https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fexample.com%2Fcalm-software"
        target="_blank"
        rel="noopener"
        aria-label="Share on LinkedIn"
        ><svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true">
          <path
            d="M5 3.5A2.5 2.5 0 1 1 5 8.5 2.5 2.5 0 0 1 5 3.5ZM3 10h4v11H3V10Zm7 0h3.8v1.6h.1c.5-1 1.8-1.9 3.6-1.9 3.9 0 4.5 2.5 4.5 5.8V21h-4v-4.9c0-1.2 0-2.7-1.7-2.7s-2 1.3-2 2.6v5h-4V10Z"
          /></svg></a
    ></li>
    <li
      ><a
        class="btn"
        data-variant="outline"
        data-size="icon-sm"
        href="mailto:?subject=Calm%20software&amp;body=https%3A%2F%2Fexample.com%2Fcalm-software"
        aria-label="Share by email"
        ><i data-lucide="mail"></i></a
    ></li>
    <li
      ><button
        type="button"
        class="btn"
        data-variant="outline"
        data-size="icon-sm"
        data-share="copy"
        aria-label="Copy link"
        ><i data-lucide="link"></i></button
    ></li>
  </ul>
</div>
```

```html example label="Share popover" hint="A Share Button opens a Popover: the URL in a read-only Input with a copy Button (.mk-share-links-url) above the share row." previewStyle="align-items:stretch;"
<button class="btn" data-variant="outline" popovertarget="share-pop" type="button"
  ><i data-lucide="share-2"></i> Share</button
>
<div class="popover" id="share-pop" popover style="width: 20rem">
  <div class="popover-header">
    <p class="popover-title">Share this article</p>
    <p class="popover-description">Anyone with the link can read it.</p>
  </div>
  <div class="popover-content" style="display: grid; gap: 0.75rem">
    <div class="mk-share-links-url">
      <input
        class="input"
        data-size="sm"
        readonly
        value="https://acme.com/blog/calm-software"
        aria-label="Article URL"
      />
      <button class="btn" data-size="sm" type="button" data-share="copy"><i data-lucide="copy"></i> Copy</button>
    </div>
    <div class="mk-share-links" role="group" aria-label="Share this article">
      <span class="mk-share-links-label">Share</span>
      <ul class="mk-share-links-list">
        <li
          ><a
            class="btn"
            data-variant="outline"
            data-size="icon-sm"
            href="https://x.com/intent/post?url=https%3A%2F%2Fexample.com%2Fcalm-software&amp;text=Calm%20software"
            target="_blank"
            rel="noopener"
            aria-label="Share on X"
            ><svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true">
              <path
                d="M18.9 2H22l-6.8 7.8L23.2 22h-6.3l-4.9-6.4L6.4 22H3.3l7.3-8.3L.8 2h6.4l4.4 5.9L18.9 2Zm-1.1 18h1.7L6.3 3.9H4.5L17.8 20Z"
              /></svg></a
        ></li>
        <li
          ><a
            class="btn"
            data-variant="outline"
            data-size="icon-sm"
            href="https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fexample.com%2Fcalm-software"
            target="_blank"
            rel="noopener"
            aria-label="Share on LinkedIn"
            ><svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true">
              <path
                d="M5 3.5A2.5 2.5 0 1 1 5 8.5 2.5 2.5 0 0 1 5 3.5ZM3 10h4v11H3V10Zm7 0h3.8v1.6h.1c.5-1 1.8-1.9 3.6-1.9 3.9 0 4.5 2.5 4.5 5.8V21h-4v-4.9c0-1.2 0-2.7-1.7-2.7s-2 1.3-2 2.6v5h-4V10Z"
              /></svg></a
        ></li>
        <li
          ><a
            class="btn"
            data-variant="outline"
            data-size="icon-sm"
            href="mailto:?subject=Calm%20software&amp;body=https%3A%2F%2Fexample.com%2Fcalm-software"
            aria-label="Share by email"
            ><i data-lucide="mail"></i></a
        ></li>
        <li
          ><button
            type="button"
            class="btn"
            data-variant="outline"
            data-size="icon-sm"
            data-share="copy"
            aria-label="Copy link"
            ><i data-lucide="link"></i></button
        ></li>
      </ul>
    </div>
  </div>
</div>
<script>
  document.addEventListener('DOMContentLoaded', () => {
    df$('#share-pop [data-share="copy"]').on('click', () => df$.shadcn.toast.show({ title: 'Link copied' }));
  });
</script>
```

<SourceFiles component="share-links" section="css" />

</DocPage>
