Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simple-react-clipboard

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-react-clipboard

A simple and flexible React utility component for copying texts to the clipboard.

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.4K
increased by20.61%
Maintainers
1
Weekly downloads
 
Created
Source

Simple React Clipboard

A simple and flexible React utility component for copying texts to the clipboard. Some code is based on clipboard.js.

Getting Started

npm i simple-react-clipboard

The component passed in the render prop will have the copy function passed in as a prop. The copy function will copy the text prop to the clipboard.

import React from "react";
import Clipboard from "simple-react-clipboard";

const Demo = () => (
  <Clipboard
    text={"Copy on Button Click"}
    render={({copy}) => <button onClick={copy}>Copy</button>}
  />
)

export default Demo;

Sample Code

Demo and sample code can be found here.

Props

NameTypeDescriptionRequired
renderfunctionA function that returns a React element.Y
textstringThe text to be copied when copy is called.Y
propsobjectprops to pass to the component in renderN
onSuccessfunctionFunction called when copy succeeds.N
onErrorfunctionFunction called when copy fails.N

To Run this Repository

  1. git clone https://github.com/donfour/simple-react-clipboard.git
  2. npm install
  3. npm run dev

To Test this Repository

npm run test

FAQs

Package last updated on 26 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc