Copy button API
Import
Section titled “Import”import { CopyButton } from '@cimpress-ui/react';Accessibility notes
Section titled “Accessibility notes”CopyButton can be activated by pressing Enter or Space, similar to a native HTML button.
Icon-only copy button should have an aria-label prop defined to identify the function of the button to assistive technologies. See our accessibility guide for more details.
API reference
Section titled “API reference”CopyButton
Section titled “CopyButton”Displays a button that allows users to copy a specific value to clipboard.
- Ref<HTMLButtonElement>
-
The
reftype for this component.
CopyButtonProps
- string
value *
Section titled “ value * ” -
The content to be copied.
- 'small' | 'medium' | 'large'
- Defaults to 'medium' .
The size of the button.
- StringLikeChildren
children
Section titled “ children ” -
The text displayed on the button.
- 'secondary' | 'tertiary'
variant
Section titled “ variant ” - Defaults to 'secondary' .
Determines the visual appearance of the button.
- string
description
Section titled “ description ” -
The description that appears in a tooltip when the user hovers or focuses the button.
- () => void
onCopy
Section titled “ onCopy ” -
A handler that gets called when the user triggers the copying.
- string
-
The element's unique identifier. See MDN.
- boolean
data-cim-style-root
Section titled “ data-cim-style-root ” -
Use this attribute to "claim" the component tree for exclusive Cimpress UI usage.
- string
UNSAFE_className
Section titled “ UNSAFE_className ” -
Sets the CSS className for the element. Only use as a last resort. Use style props instead.
See styling guide.
- CSSProperties
UNSAFE_style
Section titled “ UNSAFE_style ” -
Sets the CSS style for the element. Only use as a last resort. Use style props instead.
See styling guide.
- string
aria-label
Section titled “ aria-label ” -
Defines a string value that labels the current element.
- string
aria-labelledby
Section titled “ aria-labelledby ” -
Identifies the element (or elements) that labels the current element.
- string
aria-describedby
Section titled “ aria-describedby ” -
Identifies the element (or elements) that describes the object.
- string
aria-details
Section titled “ aria-details ” -
Identifies the element (or elements) that provide a detailed, extended description for the object.
- boolean
isDisabled
Section titled “ isDisabled ” -
Whether the button is disabled.
- (e: HoverEvent) => void
onHoverStart
Section titled “ onHoverStart ” -
Handler that is called when a hover interaction starts.
- (e: HoverEvent) => void
onHoverEnd
Section titled “ onHoverEnd ” -
Handler that is called when a hover interaction ends.
StyleProps
- Responsive<Spacing | "auto">
margin
Section titled “ margin ” -
The amount of margin applied to all edges of this component.
- Responsive<Spacing | "auto">
marginX
Section titled “ marginX ” -
The amount of margin applied to the left and right edges of this component. Takes priority over
margin. - Responsive<Spacing | "auto">
marginY
Section titled “ marginY ” -
The amount of margin applied to the top and bottom edges of this component. Takes priority over
margin. - Responsive<Spacing | "auto">
marginTop
Section titled “ marginTop ” -
The amount of margin applied to the top edge of this component. Takes priority over
marginYandmargin. - Responsive<Spacing | "auto">
marginRight
Section titled “ marginRight ” -
The amount of margin applied to the right edge of this component. Takes priority over
marginXandmargin. - Responsive<Spacing | "auto">
marginBottom
Section titled “ marginBottom ” -
The amount of margin applied to the bottom edge of this component. Takes priority over
marginYandmargin. - Responsive<Spacing | "auto">
marginLeft
Section titled “ marginLeft ” -
The amount of margin applied to the left edge of this component. Takes priority over
marginXandmargin.