DDS/Components/Copy Button

Copy Button

Display

Button that copies text to the clipboard with animated visual feedback. Uses the Clipboard API with fallback.

Playground

Controls

Props

PropTypeDefaultDescription
text*stringText to copy to the clipboard.
labelstring"Copy"Button label.
successLabelstring"Copied!"Label after successful copy.
variant'default' | 'ghost' | 'outline'"outline"Visual style.
size'sm' | 'md' | 'lg'"md"Button size.
timeoutnumber1800Duration to display success state (ms).

Examples

Ghost
vue
<DsCopyButton
  text="Hello world"
  variant="ghost"
  label="Copy snippet"
/>
Small
vue
<DsCopyButton
  text="Copy me"
  size="sm"
/>
Large
vue
<DsCopyButton
  text="Large button text"
  size="lg"
  variant="default"
/>

Skeleton

Use DsCopyButtonSkeleton as a loading placeholder while content is being fetched.

Default
vue
<DsCopyButtonSkeleton />

Accessibility

  • aria-label is dynamically updated (copied state vs. normal).
  • Visual feedback (checkmark icon + green color) is paired with a label change.