Menu
Libraries |
Category

svelte-copy

  • A Svelte action to copy text to clipboard using the navigator.clipboard API with a fallback to the legacy method.
  • Designed specifically for Svelte 5 (Svelte 3/4 support available in v1).
  • Simple usage by passing text directly or using an options object for more control.
  • Options include:
    • text: The content to copy
    • events: Array of events that trigger the copy (defaults to ['click'])
    • onCopy: Callback when copy succeeds (replaces v1's event system)
    • onError: Callback when copy fails
  • Migration notes from v1 to v2 highlight changes in event handling and requirements.
  • Documentation available at svelte-copy.willow.codes
  • Support through Discord or GitHub issues

hacktoberfestsveltesveltejs

Comments