Skip to content

feat(ui): Add "Copy SVG" button to generated badge preview #7866

Description

@navyasree41

Is your feature request related to a problem? Please describe.

Problem

Currently, users can preview the generated SVG badge, but there is no quick way to copy the SVG markup directly.

Proposed Solution

Add a "Copy SVG" button near the preview section.

Requirements

  • Copy raw SVG to clipboard.
  • Show a success toast/message after copying.
  • Handle clipboard errors gracefully.
  • Keep existing download functionality unchanged.

Acceptance Criteria

  • Copy button is visible beside the SVG preview.
  • SVG content is copied correctly.
  • Success/error feedback is displayed.
  • Responsive on desktop and mobile.

Difficulty

Good First Issue

Describe the solution you'd like

Implement a "Copy SVG" button using the Clipboard API (navigator.clipboard.writeText). When clicked, the button should copy the generated SVG markup to the clipboard and display a success notification. If copying fails due to browser restrictions or permissions, an appropriate error message should be shown.

The button should only be enabled after a badge has been successfully generated and should integrate seamlessly with the existing badge preview UI without affecting current functionality.

Describe alternatives you've considered

Some alternative approaches considered include:

  • Allowing users to manually select and copy the SVG source from a text area.
  • Providing a modal that displays the raw SVG code for copying.
  • Downloading the SVG first and copying it manually.

However, a dedicated "Copy SVG" button provides the fastest and most user-friendly experience while requiring minimal changes to the existing interface.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions