Skip to content

Clipboard

Reactive Clipboard.

🎬 Usage

<script>
  import {clipboard} from "sveltecore"

    const { text, is_supported, copy, copied } = clipboard()
</script>

👩‍💻API

Options

Name Description Type Default
read Read clipboard boolean false
source Copy from source Source undefined
copied_during Milliseconds to reset state of copied store number 1500
legacy Use legacy clipboard API boolean false

Returns

Name Description Type
is_supported Is the browser support Clipboard API Readable<boolean>
text Clipboard text Readable<string>
copied Is the text copied Readable<boolean>
copy Copy text to clipboard (text: string) => Promise<void>

🧪 Playground


Last update: 2022-11-12