1.0.2 • Published 5 years ago

@gradeup/copy-text-to-cb v1.0.2

Weekly downloads
3
License
ISC
Repository
github
Last release
5 years ago

copy-text-to-cb

React component to copy text to clipboard on clicking with function to execute after copying.

Installation

npm install --save @gradeup/copy-text-to-cb

Usage

Import the module to your code

import CopyText from '@gradeup/copy-text-to-cb'; // React Component to be used for copying text on click

usage

import CopyText from '@gradeup/copy-text-to-cb';

<CopyText 
    text="Hello copy text" 
    component={props => <button {...props}>Copy</button>}
    cb={console.log}
/>

Params

Folowing are the params to be passed :

optionused forrequireddefault
texttext to be copiedtrue-
componentcomponent on which click is to be activatedfalseprops => <button type="button" {...props}>Copy</button>
cbfunction to execute after copyingfalse() => {}
poppop message to show after copying or notfalsetrue
popStylepop box stylefalseposition: 'absolute', background: '#333', color: '#fff', padding: '3px', align: 'center', fontSize: '12px', transform: 'translateX(-50%)', left: '50%',transition: 'all 0.3s ease'

Change the text and enjoy copying on your website.

Links

You can visit some links for reference:

Organisation

Gradeup