MCPcopy Create free account
hub / github.com/coder/coder / CopyButton

Function CopyButton

site/src/components/CopyButton/CopyButton.tsx:18–42  ·  view source on GitHub ↗
({
	text,
	label,
	tooltipSide,
	...buttonProps
})

Source from the content-addressed store, hash-verified

16};
17
18export const CopyButton: FC<CopyButtonProps> = ({
19 text,
20 label,
21 tooltipSide,
22 ...buttonProps
23}) => {
24 const { showCopiedSuccess, copyToClipboard } = useClipboard();
25
26 return (
27 <Tooltip>
28 <TooltipTrigger asChild>
29 <Button
30 size="icon"
31 variant="subtle"
32 aria-label={label}
33 onClick={() => copyToClipboard(text)}
34 {...buttonProps}
35 >
36 {showCopiedSuccess ? <CheckIcon /> : <CopyIcon />}
37 </Button>
38 </TooltipTrigger>
39 <TooltipContent side={tooltipSide}>{label}</TooltipContent>
40 </Tooltip>
41 );
42};

Callers

nothing calls this directly

Calls 1

useClipboardFunction · 0.90

Tested by

no test coverage detected