Copy to clipboard button

A button that copies text to the user's clipboard.
Properties
clipboardText
tooltipText
icon

Installation

Usage

Example
Source Code
"use client";

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

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

export default CopyToClipboardButtonExample;

Props

Copy to clipboard button Props
Prop
Type
Default value
Notes
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.