Coder Social home page Coder Social logo

meghaanil / copy-button Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sudodoki/copy-button

0.0 0.0 0.0 45 KB

Web component to copy target text/dom-node value to clipboard

Home Page: http://sudodoki.github.io/copy-button/example

JavaScript 92.46% CSS 1.10% HTML 6.44%

copy-button's Introduction

<copy-button></copy-button>

A web-component that is not relying on Flash to copy stuff into the clipboard. Experience may vary, based on browser support, with downgrading to using prompt.

Installation

NPM

npm i --save copy-button after which you're good to use copy-button &

  • require it from your main file
  • add 'node_modules/copy-button/bundled.min.js' as script in your html

CDN

You can also use it from wzrd.in CDN and drop <script src='https://wzrd.in/standalone/copy-button@latest'></script> into your html

Usage

After having script ran, you're good to use <copy-button></copy-button> in your markup.

Inner content

If you're not specifying inner content, it would default to 'Click to copy to clipboard', otherwise provided content would be inserted into the button. Can use icons here, etc. See example

target-text

If you specify target-text attribute on button, provided value will be copied to clipboard. Example

target-element

If you specify target-element attribute on button, value or text of provided DOM node will be copied to clipboard (it will be retrieved using document.getElementById if value will be specified as #specifiedID or document.querySelectorAll in other cases). See examples

Under the hood

Built on top of document.registerElement polyfill & copy-to-clipboard

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.