Skip to content

πŸ“‹ Kopiert (copies) text to the clipboard in the browser

License

Notifications You must be signed in to change notification settings

BetaHuhn/kopiert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

35 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“‹ 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.