Skip to content
Vue.js clipboard library (no dependencies, less than 2kb)
Branch: master
Clone or download
Latest commit 1805909 Jun 3, 2019

npm version

Vue.js Clipboard


npm install --save v-clipboard
import Vue       from 'vue'
import Clipboard from 'v-clipboard'



When an element that contains v-clipboard directive is clicked, the value of value will be copied into clipboard.

Copying static value (directive should receive actual value):

<button v-clipboard="value">
  Copy to clipboard

Copying dynamic value (directive should recieve a function that returns value):

<button v-clipboard="() => value">
  Copy to clipboard

Copying anything in your methods:



<button v-clipboard="foo"
        v-clipboard:success="clipboardSuccessHandler" // Success event handler 
        v-clipboard:error="clipboardErrorHandler">    // Error event handler
  Copy to clipboard
  methods: {
    clipboardSuccessHandler ({ value, event }) {
      console.log('success', value)

    clipboardErrorHandler ({ value, event }) {
      console.log('error', value)


You can’t perform that action at this time.