@api-components/clipboard-copy
v3.0.0-preview.1
Published
An element that copies a text to clipboard
Downloads
6
Readme
LogicElements.ClipboardCopy component
Tag: <clipboard-copy>
Installation
Using bower:
bower install --save advanced-rest-client/clipboard-copy
An element that copies a text to clipboard.
Example
<clipboard-copy content="test"></clipboard-copy>
<script>
const elm = document.querySelectior('clipboard-copy');
if(elm.copy()) {
console.info('Content has been copied to the clipboard');
} else {
console.error('Content copy error. This browser is ancient!');
}
< /script>
API
Component properties (attributes)
content
- Type:
string
A content to be copied to the clipboard. It must be set before calling thecopy
function.
Component methods
copy
- Return type:
Boolean
Execute content copy.