1.0.0 • Published 5 years ago

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

Weekly downloads
1
License
MIT
Repository
github
Last release
5 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

5 years ago

0.1.19

5 years ago

0.1.18

5 years ago

0.1.15

5 years ago

0.1.16

5 years ago

0.1.17

5 years ago

0.1.14

5 years ago

0.1.13

5 years ago

0.1.12

5 years ago

0.1.11

5 years ago

0.1.10

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago