Clipboard.js lets you copy text to clipboard. It’s tiny at 2KB and doesn’t use Flash. Here’s how to use it in your next Meteor project.

First, create the Meteor project “demo.”

meteor create demo
cd demo
meteor

Add the Clipboard.js CDN link to the HEAD of your demo.html file and create a new button.

# demo.html
<head>
  <title>demo</title>
  <script src="//cdn.rawgit.com/zenorocha/clipboard.js/master/dist/clipboard.min.js"></script>
</head>

<body>
  <h1>Welcome to Meteor!</h1>
  {{> hello}}
</body>

<template name="hello">
  <button class="btn-copy-link" data-clipboard-text="wsvincent.com">Copy wsvincent.com</button>
  <button>Click Me</button>
  <p>You've pressed the button {{counter}} times.</p>
</template>

Now to make it work in Meteor add an onRendered function to “demo.js”:

if (Meteor.isClient) {
  Template.hello.onRendered(function() {
    var clipboard = new Clipboard('.btn-copy-link');
});

And BOOM we’re done!