MCPcopy
hub / github.com/supermemoryai/supermemory / CopyButton

Function CopyButton

packages/ui/copy-button.tsx:17–50  ·  view source on GitHub ↗
({
	value,
	className,
	src,
	variant = "ghost",
	...props
}: CopyButtonProps)

Source from the content-addressed store, hash-verified

15}
16
17export function CopyButton({
18 value,
19 className,
20 src,
21 variant = "ghost",
22 ...props
23}: CopyButtonProps) {
24 const [hasCopied, setHasCopied] = React.useState(false)
25
26 useEffect(() => {
27 setTimeout(() => {
28 setHasCopied(false)
29 }, 2000)
30 }, [])
31
32 return (
33 <Button
34 className={cn(
35 "relative z-10 text-zinc-50 hover:bg-zinc-700 hover:text-zinc-50 [&_svg]:h-full [&_svg]:w-full",
36 className,
37 )}
38 onClick={() => {
39 navigator.clipboard.writeText(value)
40 setHasCopied(true)
41 }}
42 size="icon"
43 variant={variant}
44 {...props}
45 >
46 <span className="sr-only">Copy</span>
47 {hasCopied ? <CheckIcon /> : <ClipboardIcon />}
48 </Button>
49 )
50}

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…