Welcome to Vanilla Breeze
This bell pulls live notifications from /go/notify/messages — the same contract documented at /docs/concepts/service-contracts/. Static articles like this one are the no-JS / no-backend fallback.
This bell pulls live notifications from /go/notify/messages — the same contract documented at /docs/concepts/service-contracts/. Static articles like this one are the no-JS / no-backend fallback.
Social share component with native Web Share API and platform fallbacks
<share-wc> provides social sharing with three-tier progressive enhancement:
navigator.share()<a> links work without JavaScript<share-wc></share-wc>
| Attribute | Type | Default | Description |
|---|---|---|---|
url |
string | location.href |
URL to share |
title |
string | document.title |
Share title |
text |
string | Meta description | Share description text |
platforms |
string | x,linkedin,bluesky,mastodon,whatsapp,email,copy |
Comma-separated platform list |
variant |
string | icon-label |
Visual variant: icon, label, icon-label |
size |
string | m |
Button size: s, m, l |
label |
string | Share |
Label for Tier 1 native button |
color |
boolean | absent | Use platform brand colours |
mastodon-instance |
string | mastodon.social |
Mastodon instance for share URL |
tier |
string | auto | Force tier: native or platforms. Overrides auto-detection. |
Choose which platforms to show with platforms. Order controls render order.
<share-wc platforms="x,linkedin,bluesky,email,copy"></share-wc>
| ID | Label | Action |
|---|---|---|
x | X | Opens X/Twitter compose |
twitter | X | Alias for x |
facebook | Opens Facebook sharer | |
linkedin | Opens LinkedIn share | |
whatsapp | Opens WhatsApp (native app on mobile) | |
telegram | Telegram | Opens Telegram share |
bluesky | Bluesky | Opens Bluesky compose |
mastodon | Mastodon | Opens Mastodon share (configurable instance) |
email | Opens email client via mailto: | |
copy | Copy link | Copies URL to clipboard with 2s feedback |
Show icons without labels using variant="icon".
<share-wc platforms="x,linkedin,bluesky,copy" variant="icon"></share-wc>
Show labels without icons using variant="label".
<share-wc platforms="x,linkedin,email,copy" variant="label"></share-wc>
Add color to apply platform brand colours.
<share-wc platforms="x,linkedin,whatsapp,bluesky,mastodon" color></share-wc>
Use size="s" or size="l" for small or large buttons.
<share-wc platforms="x,linkedin,copy" size="s"></share-wc> <share-wc platforms="x,linkedin,copy"></share-wc> <share-wc platforms="x,linkedin,copy" size="l"></share-wc>
Override the auto-detected URL, title, and text with explicit attributes.
<share-wc url="https://example.com/article" title="Interesting Article" text="A fascinating read about web components" platforms="x,linkedin,email,copy"></share-wc>
| Field | Priority |
|---|---|
| URL | url → <link rel="canonical"> → location.href |
| Title | title → og:title → document.title |
| Text | text → meta[name=description] → og:description → empty |
For full no-JS support, slot <a> elements with data-platform attributes. The component enhances them with click handlers and substitutes {url}, {title}, {text} tokens in href values.
<share-wc> <a href="https://x.com/intent/post?url={url}&text={title}" data-platform="x" target="_blank" rel="noopener noreferrer"> Post on X </a> <a href="https://www.linkedin.com/sharing/share-offsite/?url={url}" data-platform="linkedin" target="_blank" rel="noopener noreferrer"> LinkedIn </a> <button type="button" data-platform="copy">Copy link</button></share-wc>
On devices with navigator.share (macOS, iOS, Android), the component auto-selects the native share sheet. Use tier="platforms" to always show individual platform buttons instead, giving authors full control over which platforms appear.
<!-- Force platform buttons even on devices with Web Share API --><share-wc tier="platforms" platforms="x,linkedin,bluesky,copy" color></share-wc>
Use platforms="native-only" to show only the native share button. Hides entirely on platforms without Web Share API support.
<share-wc platforms="native-only"></share-wc>
Set a custom Mastodon instance with mastodon-instance. Defaults to mastodon.social.
<share-wc platforms="mastodon" mastodon-instance="fosstodon.org"></share-wc>
| Event | Detail | Description |
|---|---|---|
share-wc:open |
{ platform } |
Fired when a share is initiated |
share-wc:success |
{ platform } |
Fired after successful share or copy |
share-wc:error |
{ platform, error } |
Fired on failure (user cancel is not an error) |
const share = document.querySelector('share-wc'); share.addEventListener('share-wc:success', (e) => { console.log(`Shared via ${e.detail.platform}`);}); share.addEventListener('share-wc:error', (e) => { console.error(`Share failed: ${e.detail.error}`);});
| Property/Method | Type | Description |
|---|---|---|
url |
get/set | Current share URL |
title |
get/set | Current share title |
text |
get/set | Current share description |
share() |
method | Programmatically trigger native share |
const share = document.querySelector('share-wc'); // Update share datashare.url = 'https://example.com/new-page';share.title = 'New Title'; // Trigger native share programmaticallyshare.share();
aria-label="Share this page"<nav aria-label="Share this page">aria-live="polite"aria-hidden="true"icon variant (visually hidden, not removed)prefers-reduced-motion