Skip to content

Add "Copy to Clipboard" Button for Prompts #2

@protocolus

Description

@protocolus

Problem Statement

Currently, users need to manually select and copy prompt content when they want to use it in Claude, Claude Code, or other LLMs. This creates unnecessary friction in the workflow, especially when working with longer prompts or when frequently switching between prompts.

Proposed Solution

Implement a one-click copy functionality that allows users to quickly copy prompt content to their clipboard with visual feedback confirming the action.

Feature Specification

Core Functionality

  • Add a "Copy" button to each prompt in both list and detail views
  • Copy the prompt's main content (excluding metadata) to clipboard on click
  • Provide visual feedback when content is successfully copied
  • Handle errors gracefully if clipboard access fails

Implementation Details

1. UI Components

  • Add a copy icon button (suggested: clipboard icon from existing icon set or inline SVG)
  • Position: top-right corner of prompt cards in list view, and near the title in detail view
  • Style: Subtle by default, more prominent on hover
  • Accessibility: Include proper ARIA labels and keyboard support

2. Technical Implementation

// Example implementation
const copyToClipboard = async (promptContent) => {
  try {
    await navigator.clipboard.writeText(promptContent);
    showToast('Copied to clipboard!');
  } catch (err) {
    // Fallback for older browsers
    const textArea = document.createElement('textarea');
    textArea.value = promptContent;
    document.body.appendChild(textArea);
    textArea.select();
    document.execCommand('copy');
    document.body.removeChild(textArea);
    showToast('Copied to clipboard!');
  }
};

3. User Feedback

  • Show "Copied!" confirmation for 2 seconds
  • Use a toast notification or tooltip near the button
  • Consider adding a subtle animation (e.g., checkmark replacing the copy icon briefly)

Acceptance Criteria

  • Copy button appears on all prompt views
  • Clicking the button copies the prompt content to clipboard
  • Visual confirmation appears after successful copy
  • Feature works across modern browsers (Chrome, Firefox, Safari, Edge)
  • Keyboard shortcut implemented (Ctrl/Cmd + K when prompt is focused)
  • Graceful fallback for browsers without Clipboard API support
  • WCAG 2.1 AA accessibility compliance

Benefits

  • Improved UX: Reduces friction in the primary use case of copying prompts
  • Time-saving: Eliminates manual selection, especially for long prompts
  • Professional feel: Standard feature expected in modern web applications
  • Accessibility: Helps users with motor difficulties who find precise text selection challenging

Resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    clide-analyzedIssue has been analyzed by ClaudeenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions