kopiert

1.0.7 • Public • Published

📋 Kopiert

Node CI Release CI GitHub David

Kopiert (copies) text to the clipboard in the browser

👋 Introduction

It's quite simple, include kopiert in your site and start copying text to the clipboard.

🚀 Get started

Script tag

Add this to your HTML page:

<script src="https://cdn.jsdelivr.net/npm/kopiert/dist/kopiert.min.js"></script>
<script>
    kopiert.toClipboard('This text will be copied to your clipboard') // For example on a button press
</script>

NPM

Install kopiert using NPM:

npm install kopiert

Then add the following JavaScript code:

import kopiert from 'kopiert'

kopiert.toClipboard('This text will be copied to your clipboard')

Both methods will copy the specified text to the users clipboard.

📖 Examples

On button click

<p id="text">This text will be copied to your clipboard.</p>
<button id="btn">Copy text</button>

<script src="https://cdn.jsdelivr.net/npm/kopiert/dist/kopiert.min.js" ></script>
<script>
    document.getElementById('btn').addEventListener('click', function() {
        const text = document.getElementById('text').textContent
        kopiert.toClipboard(text)
    })
</script>

💻 Development

  • run yarn lint or npm run lint to run eslint.
  • run yarn build or npm run build to produce a minifed version in the dist folder.

About

This project was developed by me (@betahuhn) in my free time. If you want to support me:

Donate via PayPal

ko-fi

📄 License

Copyright 2021 Maximilian Schiller

This project is licensed under the MIT License - see the LICENSE file for details.

Readme

Keywords

none

Package Sidebar

Install

npm i kopiert

Weekly Downloads

7

Version

1.0.7

License

MIT

Unpacked Size

5.45 kB

Total Files

4

Last publish

Collaborators

  • betahuhn