0.1.0 • Published 2 years ago

solid-copy-to-clipboard v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

solid-copy-to-clipboard

npm npm version npm downloads sponsors

A lightweight copy to clipboard utility for Solid with custom event triggers, written in Typescript and based on the original copy-to-clipboard.

Usage

Installation

npm install solid-copy-to-clipboard --save
yarn add solid-copy-to-clipboard ## or in yarn

Example

import { Component } from 'solid-js'
import { CopyToClipboard } from 'solid-copy-to-clipboard'


const Page: Component = () => (
  <CopyToClipboard
    text='Text to be copied'
    onCopy={ () => console.log('Copied!') }
    eventTrigger='onMouseOver'
  >
    <div>Hover over me to copy To clipboard ✨</div>
  </CopyToClipboard>
)

API

text

string

The text to be copied.

onCopy

(text: string, result: boolean) => void - OPTIONAL

Callback function once text is copied.

eventTrigger

string - OPTIONAL

Optional event trigger, defaults to onClick.

options

object - OPTIONAL

Optional options for copy-to-clipboard.

License

MIT