0.0.7 • Published 1 month ago

@nichoth/copy-button v0.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

copy button

tests module semantic versioning license

A button to copy some text to the system clipboard, made with webcomponents.

install

npm i -S @nichoth/copy-button

use

globals

This looks at a css variable --success-color, which is used to color the checkmark that is displayed after you copy something.

index.js

Import this file. It depends on tonic and clipboard-copy, so you will need to provide them somehow, either through a bundler or importmap.

import { CopyButton } from '@nichoth/copy-button'

index.bundle.js

Import this file, including all its dependencies.

import { CopyButton } from '@nichoth/copy-button/bundle'

index.min.js

Use a minified version of this file. It includes all dependencies.

import { CopyButton } from '@nichoth/copy-button/min'

example

Include the CSS.

import { CopyButton } from '@nichoth/copy-button'
import '@nichoth/copy-button/style.css'

document.body.innerHTML = `
  <${copy-button} payload="example text">
  </${copy-button}>
`

Create a button like this

screenshot of the button, pre-click


screenshot of the button, post-click

0.0.7

1 month ago

0.0.6

1 month ago

0.0.5

1 month ago

0.0.4

1 month ago

0.0.3

1 month ago

0.0.2

1 month ago

0.0.1

1 month ago

0.0.0

1 month ago