MCPcopy Index your code
hub / github.com/code-hike/codehike / CopyButton

Function CopyButton

apps/web/components/copy-button.tsx:7–32  ·  view source on GitHub ↗
({
  text,
  className,
}: {
  text: string
  className?: string
})

Source from the content-addressed store, hash-verified

5import { cn } from "../lib/utils"
6
7export function CopyButton({
8 text,
9 className,
10}: {
11 text: string
12 className?: string
13}) {
14 const [copied, setCopied] = React.useState(false)
15
16 return (
17 <button
18 className={cn(
19 `hover:bg-gray-400/20 -m-1 p-1 rounded hidden sm:block`,
20 className,
21 )}
22 onClick={() => {
23 navigator.clipboard.writeText(text)
24 setCopied(true)
25 setTimeout(() => setCopied(false), 1200)
26 }}
27 aria-label="Copy to clipboard"
28 >
29 {copied ? <Check size={16} /> : <Copy size={16} />}
30 </button>
31 )
32}

Callers

nothing calls this directly

Calls 1

cnFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…