svelte-code-copy Svelte Themes

Svelte Code Copy

❏ Just wrap it with this

svelte-code-copy

npm-version npm-license npm-download-month npm-min-size ci.yml website

❏ Just wrap it with this

Demo

Installation

npm i svelte-code-copy

Usage

pre is optional. <CodeCopy> copies the innerText of <code>

<script>
  import { CodeCopy } from 'svelte-code-copy'
</script>

<CodeCopy>
  <pre>
    <code>
      <!-- Your code block -->
    </code>
  </pre>
</CodeCopy>

Props

full details

Prop Type Default
onCopy function undefined
size number 18
background string transparent
color string whitesmoke
success string green
error string red
top string 0.5rem
right string 0.5rem
border string none
padding string 0.25rem
borderRadius string 0.25rem
margin string 0
effect string pop
duration number 150

License

MIT

Top categories

Loading Svelte Themes