DefinitelyTyped/types/react-copy-to-clipboard/react-copy-to-clipboard-tests.tsx
Ward Delabastita 9ae12bafb1 Update type definitions for "react-copy-to-clipboard" (#38565)
* add required property children to Props

* name function arguments for onCopy

* put required props before optional

* make all Options attributes optional and add format

* extend and add tests

* indicate lib version for these types and add contributor
2019-09-27 09:27:31 -07:00

25 lines
688 B
TypeScript

import * as React from "react";
import CopyToClipboard = require("react-copy-to-clipboard");
export class OnlyRequiredProps extends React.Component {
render() {
return (
<CopyToClipboard text={"Hello World"}>
<button>Copy to clipboard with button</button>
</CopyToClipboard>
);
}
}
export class AllProps extends React.Component {
render() {
return (
<CopyToClipboard text={"Hello World"}
onCopy={() => {}}
options={{debug: true, message: "message", format: "text/plain"}}>
<span>Copy to clipboard with span</span>
</CopyToClipboard>
);
}
}