CopyToClipboardButton

A button that copies text to the clipboard when clicked.

Internal Component

This component is intended solely for use within GitHub and is not available for external use.

Props

CopyToClipboardButton

NameDefaultDescription
icon
CopyIcon
Icon

Octicon that is displayed on the copy button

size
'small' | 'medium' | 'large'

Size of the button, passed to IconButton

onCopy
() => void

Optional callback that is invoked when the user clicks the copy button

textToCopy Required
string

Text that will be copied to the clipboard

tooltipProps
Omit<TooltipProps & SxProp, 'text' | 'aria-label' | 'type' | 'id' | 'aria-hidden'>

Props that will be applied to tooltips

variant
invisible
VariantType

Which icon button variant to use

ariaLabel
Copy "${textToCopy}" to clipboard
string

Text that will be displayed in the tooltip