Miss any of our Open RFC calls?Watch the recordings here! »

@gradeup/copy-text-to-cb

1.0.2 • Public • Published

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 :

option used for required default
text text to be copied true -
component component on which click is to be activated false props => <button type="button" {...props}>Copy</button>
cb function to execute after copying false () => {}
pop pop message to show after copying or not false true
popStyle pop box style false position: '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

Install

npm i @gradeup/copy-text-to-cb

DownloadsWeekly Downloads

19

Version

1.0.2

License

ISC

Unpacked Size

9.14 kB

Total Files

8

Last publish

Collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar