v-clipboard
Updated on Sep 5, 2025 2 minutes to readThe v-clipboard directive allows you to copy text to the clipboard when an element is clicked, and optionally handle success or error callbacks.
- You provide the text to copy as the directive value.
- You can optionally specify success and error handlers using arguments.
- If no success or error arguments are provided, the directive will only perform the copy action without callbacks.
- The directive automatically manages click event listeners.
- Handlers and copied value are updated automatically when bindings change.
- All event listeners and handlers are properly cleaned up when the element is removed from the DOM.
<e8-button
v-clipboard:success="() => $notify.success('Success')"
v-clipboard:error="() => $notify.danger('Error')"
v-clipboard="'Hello world!'"
>
Copy with callbacks
</e8-button>
🔽 Show more