Modern copy to clipboard. No Flash. Just 3kb gzipped


Copying text to the clipboard shouldn't be hard. It shouldn't require dozens of steps to configure or hundreds of KBs to load.
But most of all, it shouldn't depend on Flash or any bloated framework. That's why clipboard.js exists.

Copy text from another element

A pretty common use case is to copy content from another element. You can do that by adding a data-clipboard-target attribute in your trigger element.

Cut text from another element

Additionally, you can define a data-clipboard-action attribute to specify if you want to either copy or cut content.

If you omit this attribute, copy will be used by default.
As you may expect, the cut action only works on <input> or <textarea> elements.

Copy text from attribute

Truth is, you don't even need another element to copy its content from. You can just include a data-clipboard-text attribute in your trigger element.

Copy text from another element

There are cases where you'd like to show some user feedback or capture what has been selected after a copy/cut operation.

That's why we fire custom events such as success and error for you to listen and implement your custom logic.

let clipboard = new Clipboard( ".btn" );

clipboard.on( "success", => (e) { "Action : ", e.action ); "Text : ", e.text ); "Trigger : ", e.trigger );


clipboard.on( "error", => (e) {
    console.error( "Action : ", e.action );
    console.error( "Trigger : ", e.trigger );
Paste your copied text.

Background Images

Add an image to replace the solid background color
Additional Offcanvas New in BS v.5.0

Select the offcanvas placement.

Right sidebar
Color Schemes
Light Completely bright color themes.
Dark Completely dark color themes.
Expanded Header
Fair Header
Full Header
Primary Nav
Tall Header New in v3.0

Hides native scrollbars and creates custom styleable overlay scrollbars.

Offcanvas Header
Content Here

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sapiente eos nihil earum aliquam quod in dolor, aspernatur obcaecati et at. Dicta, ipsum aut, fugit nam dolore porro non est totam sapiente animi recusandae obcaecati dolorum, rem ullam cumque. Illum quidem reiciendis autem neque excepturi odit est accusantium, facilis provident molestias, dicta obcaecati itaque ducimus fuga iure in distinctio voluptate nesciunt dignissimos rem error a. Expedita officiis nam dolore dolores ea. Soluta repellendus delectus culpa quo. Ea tenetur impedit error quod exercitationem ut ad provident quisquam omnis! Nostrum quasi ex delectus vero, facilis aut recusandae deleniti beatae. Qui velit commodi inventore.