3.0.0-preview.1 • Published 5 years ago

@api-components/clipboard-copy v3.0.0-preview.1

Weekly downloads
4
License
Apache-2.0
Repository
github
Last release
5 years ago

Build Status

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 the copy function.

Component methods

copy

  • Return type: Boolean Execute content copy.