Copy to clipboard button

A button that copies text to the user's clipboard.
Properties
clipboardText
tooltipText
icon
Example
Source Code
Installation
"use client";

import React from "react";
import { CopyToClipboardButton } from "@/subframe/components/CopyToClipboardButton";

function CopyToClipboardButtonExample() {
  return (
    <CopyToClipboardButton
      clipboardText=""
      tooltipText="Copy to clipboard"
      icon="FeatherClipboard"
      onCopy={() => {}}
    />
  );
}

export default CopyToClipboardButtonExample;

Props

Copy to clipboard button
Prop
Type
Default
Additional info
clipboardText
string
""
The text to be copied to the clipboard
tooltipText
string
"Copy to clipboard"
icon
IconName
"FeatherClipboard"
onCopy
() => void
Handler called when the text is copied.

Examples

Basics

Use clipboardText prop for the text that is copied on click, tooltipText for the tooltip copy.

Confirmation message

Use onCopy prop to show feedback to user after copying.