ClipboardCopyButton

readyNot reviewed for a11y
This page may be removed. Primer plans to move all Rails component documentation to Lookbook.

Description

ClipboardCopyButton uses the ClipboardCopy component to copy text to the clipboard, styled as a Primer button. It can be used wherever a button is desired, and works well with components like ButtonGroup.

Accessibility

This component has a built-in aria-live region that announces "Copied!" when the copy button is pressed.

Arguments

NameRequiredDescription
system_arguments
Hash

The arguments accepted by Primer::Beta::Button and Primer::Beta::ClipboardCopy.

Slots

leading_visual

Leading visuals appear to the left of the button text.

Use:

  • leading_visual_icon for a Primer::Beta::Octicon.

  • leading_visual_svg to render a SVG.

NameRequiredDescription
system_arguments
Hash

Same arguments as Primer::Beta::Octicon.

trailing_visual

Trailing visuals appear to the right of the button text.

Use:

  • trailing_visual_counter for a Primer::Beta::Counter.
NameRequiredDescription
system_arguments
Hash

Same arguments as Primer::Beta::Counter.

trailing_action

Trailing action appears to the right of the trailing visual.

Use:

  • trailing_action_icon for a Primer::Beta::Octicon.
NameRequiredDescription
system_arguments
Hash

Same arguments as Primer::Beta::Octicon.

tooltip

Tooltip that appears on mouse hover or keyboard focus over the button. Use tooltips sparingly and as a last resort. Important: This tooltip defaults to type: :description. In a few scenarios, type: :label may be more appropriate. Consult the Primer::Alpha::Tooltip documentation for more information.

NameRequiredDescription
type
Symbol

One of :description or :label.

system_arguments
Hash

Same arguments as Primer::Alpha::Tooltip.