Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

web-copy-to-clipboard

balthier14ISC1.1.2TypeScript support: included

Simple module that copies a text to clipbard.

copyToClipboard, clipboard, copy

readme

web-copy-to-clipboard 📋

This is a simple module that helps you to easily implement a functionality to copy text to clipboard.

Installation

Run: npm install web-copy-to-clipboard or yarn add web-copy-to-clipboard

Usage

All you need to do is to import the module, and then call it's function anywhere you want to trigger it.

React.js example:

import React from 'react';
import copyToClipboard from  'web-copy-to-clipboard';

export default function  App() {

    return (
        <button
            // calling the function when clicking a button
            onClick={() => copyToClipboard("I'll be copied!")}
        >
            'Copy text'
        </button>
    )
}