Svelte Share Demo

Features

  • ✨ Multiple social platforms support
  • 📱 Mobile-friendly design
  • 🌐 Web Share API support
  • 📋 Copy to clipboard functionality
  • 🌍 Internationalization support
  • 🎨 Customizable appearance

Implementation

Add the share buttons to your SvelteKit project in three simple steps:

1. Install the package

npm install @1lev1/svelte-share

2. Import the component

import { ShareButtons } from '@1lev1/svelte-share';

3. Use in your component

<script>
    const siteInfo = {
        siteTitle: "Your Site Name",
        siteUrl: "https://yoursite.com"
    };

    const shareConfig = {
        slug: "page-slug",
        title: "Your Page Title",
        desc: "Page description",
        hashtags: ["svelte", "webdev"],
        via: "@TwitterHandle",
        related: ["@sveltejs"],
        quote: "Share quote",
        lang: "en"  // or "he" for Hebrew
    };
</script>

<ShareButtons {...siteInfo} {...shareConfig} />

Available Props

PropTypeDescription
siteTitlestringYour website's name
siteUrlstringYour website's URL
slugstringPage path/slug
titlestringShare title
descstringShare description
hashtagsstring[]Array of hashtags (without #)
viastringTwitter handle (with @)
langstring"en" or "he"
sizenumberSize of the buttons

Credits

This component is built with inspiration from and gratitude to:

svelte-share-buttons-component

Our component is inspired by and based on svelte-share-buttons-component by Paul Chynoweth.