@synqro/social-share
v1.1.1
Published
Share content on social media with simple HTML attributes for Webflow and no-code platforms.
Maintainers
Readme
@synqro/social-share
Add social sharing buttons to your Webflow site with simple custom attributes. No code needed!
Installation in Webflow
Add the script to your site
Go to Project Settings → Custom Code → Footer Code and paste:
<!-- [Synqro Labs] Social Share --> <script src="https://cdn.jsdelivr.net/npm/@synqro/social-share@1/dist/index.min.js"></script>Add share buttons
Create buttons or links in your Webflow designer, then add custom attributes:
Publish your site
Custom Attributes
Select any button or link element in Webflow, then add one of these custom attributes:
| Attribute | Value | What it does |
| ---------------------- | ------------------- | ------------------------------------------------------------- |
| sl-share-fb | (leave empty) | Share on Facebook |
| sl-share-linkedin | (leave empty) | Share on LinkedIn (uses your page's OG meta tags for the preview) |
| sl-share-x | (leave empty) | Share on X/Twitter with page title |
| sl-share-copy | (leave empty) | Native share sheet on mobile, copy to clipboard on desktop |
| sl-share-text | Your custom text | Custom text for X share (optional, uses h1 by default) |
| sl-share-copy-confirm | Your custom message | Custom toast text after copying (default: Link copied!) |
| sl-share-error-confirm | Your custom message | Custom toast text if the copy fails (default: Failed to copy link.) |
| sl-share-toast | false | Disable the toast notification (use CSS hooks instead, see below) |
Examples
Basic Setup (share current page)
- Create a button in Webflow
- Select the button
- Add custom attribute:
sl-share-fb(no value needed) - Done! The button now shares your page on Facebook
For all platforms:
sl-share-fb→ Facebooksl-share-linkedin→ LinkedInsl-share-x→ X (Twitter)sl-share-copy→ Copy link
With Custom Text (X only)
To customize the text for X:
- Add the share attribute:
sl-share-x - Add text attribute:
sl-share-textwith value"Check out this article!"
By default, it automatically uses your page's first <h1> as the text.
Note on LinkedIn: LinkedIn doesn't accept a text parameter anymore — it pulls the preview (title, description, image) directly from your page's Open Graph meta tags (
og:title,og:description,og:image). Make sure those are set properly in Webflow's Page Settings → SEO.
Custom Copy Message
For the copy button (desktop only — mobile uses the native share sheet):
- Add attribute:
sl-share-copy - Add attribute:
sl-share-copy-confirmwith value"Copied!"
Auto-translated messages: The script auto-detects your page language from the <html lang="..."> attribute (set automatically by Webflow on multilingual sites). Supported languages:
| Language | Copied | Error | | -------- | -------------------- | ---------------------------- | | English | Link copied! | Failed to copy link. | | French | Lien copié ! | Échec de la copie du lien. | | Spanish | ¡Enlace copiado! | Error al copiar el enlace. | | German | Link kopiert! | Kopieren fehlgeschlagen. |
If the page language isn't in this list, English is used as fallback. To override entirely, use sl-share-copy-confirm and sl-share-error-confirm.
Toast Notification
When the copy button is clicked on desktop, a small black pill appears above the button with a confirmation message, then fades out after 2 seconds.
Customize the toast appearance
The toast uses the class .sl-share-toast. Add this to your Webflow custom code (or global CSS) to override the default styles:
.sl-share-toast {
background: #0066ff;
color: #fff;
font-family: 'Your Font', sans-serif;
border-radius: 4px;
}Disable the toast and use your own UI
Set sl-share-toast="false" on the button. The script will still add temporary CSS classes you can hook into:
sl-share-copied— added for 2 seconds after a successful copysl-share-error— added for 2 seconds if the copy fails
Example in Webflow: create an interaction that shows a custom element when the class sl-share-copied is added to the button.
What happens when users click
- Facebook: Opens a popup to share the page
- LinkedIn: Opens a popup that works on desktop AND mobile (uses your page's OG meta tags)
- X (Twitter): Opens a popup with your page title + URL pre-filled
- Copy:
- On mobile (or any device with the Web Share API): opens the native share sheet — the user can share to any installed app (WhatsApp, Messages, Mail, Instagram DM, LinkedIn, etc.)
- On desktop: copies the URL to the clipboard and shows a toast notification
Smart defaults:
- Automatically uses your page's first
<h1>as the share text for X - Falls back to just the URL if no h1 exists
- Works with all browsers
Tips
- Works on any element (buttons, links, divs, etc.)
- No styling included - style your buttons however you want in Webflow
- Can share any URL by adding it as the attribute value:
sl-share-fb="https://example.com" - Perfect for blog posts, portfolio pieces, product pages
