1.0.0 • Published 4 years ago

@svc/react-copy-to-clipboard v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

@svc/react-copy-to-clipboard

With the help of @svc/react-copy-to-clipboard the text can be copied from a HTMLElement/HTMLInputElement

Installing

Using npm: npm i @svc/react-copy-to-clipboard

Using yarn: yarn add @svc/react-copy-to-clipboard

Example

Codesandbox

import React from "react";
import copyToClipboard from "@svc/react-copy-to-clipboard";

export default function App() {
  const [h1ref, setClipboardFromH1] = copyToClipboard();
  const [inputRef, setClipboardFromInput] = copyToClipboard();

  return (
    <div className="App">
      <div>
        <h1 ref={h1ref}>Hello CodeSandbox</h1>
        <button onClick={setClipboardFromH1}>Copy Text from H1</button>
      </div>
      <div>
        <input type="text" ref={inputRef} />
        <button onClick={setClipboardFromInput}>Copy Text from input</button>
      </div>
    </div>
  );
}
1.0.0

4 years ago

0.1.19

4 years ago

0.1.18

4 years ago

0.1.15

4 years ago

0.1.16

4 years ago

0.1.17

4 years ago

0.1.14

4 years ago

0.1.13

4 years ago

0.1.12

4 years ago

0.1.11

4 years ago

0.1.10

4 years ago

0.1.9

4 years ago

0.1.8

4 years ago