Share menu to copy a link or post to X, LinkedIn, and the native share sheet.
@lucide/sveltesvelte-sonner
Installation
Install dependencies
Install the required packages for this component:
Copy the Source Code
Copy and paste the following code into your project:
index.ts
linkedin-icon.svelte
share-menu.svelte
x-icon.svelte
Features
- Copy the link to the clipboard with toast feedback
- Share directly to X and LinkedIn in a new tab
- Resolves relative URLs against the current origin
- Shows the native share option only when the Web Share API is available
Props
ShareMenu
Menu for copying or sharing a URL through supported services.
| Name | Type | Default | Description |
|---|---|---|---|
title | string | required | Title passed to the native share sheet. |
url | string | required | URL to share; relative values are resolved against the current origin. |