1.0.2 • Published 5 years ago

react-copy-to-clipboard-ui v1.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

React Copy To Clipboard UI

A react component to display text with copy to clipboard option

alt text

Installation

Use npm to install

npm i -S react-copy-to-clipboard-ui

Usage

import ReactCopyToClipboardUI from 'react-copy-to-clipboard-ui';

function MyComponent = () => (
    <ReactCopyToClipboardUI>This is my text</ReactCopyToClipboardUI>
);

Props

PropsTypeDefault ValueDescription
childrenReact component or stringthis is copyable textThe text to display
copyTextstringnullThe text that should be copied to clipboard when action button is clicked. Note: if null, then the value of the children prop will be copied.
btnLabelstringcopyThe action button label to show when the mouse hovers over the component
onCopyBtnLabelstringcopiedThe action button label to show after copy action takes place. This label will stay for onCopyBtnLabelDuration value
containerStyleobjectStyle of the container
aciveContainerStyleobjectStyle of the container when the mouse hovers over the component
textStyleobjectStyle of the displayed text
activeTextStyleobjectstyle of the displayed text when the mouse hovers over the component
btnStyleobjectstyle of the action button
onCopyfuncnullcallback function when action button is clicked. Receives the copied text as the parameter
onMouseEnterfuncnullcallback function when the mouse enters the component
onMouseLeavefuncnullcallback function when the mouse leaves the component

License

MIT