Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

123
Views
How to Copy Formatted Email to Clipboard

I am using React and I have an email template that I want to provide users. I have created a formatted email component and tried using dangerouslySetInnerHTML to show the formatted email in a dialog.

I want to know if there is a way for me to add copy to clipboard button to copy the email with all of the formatting including bolding and hyperlinks.

I would prefer to use the FormattedEmail component but would be okay with using dangerouslySetInnerHTML.

Option 1

<Dialog
   isShown={showDialog}
   onCloseComplete={() => setShowDialog(false)}
   topOffset={4}
   footer={ <Button onClick={CopyToClipboard}> Click here to copy the template </Button>}
>
    <FormattedEmail />
</Dialog>

Option 2

<Dialog
   isShown={showDialog}
   onCloseComplete={() => setShowDialog(false)}
   topOffset={4}
   footer={ <Button onClick={CopyToClipboard}> Click here to copy the template </Button>}
>
 <div id="to-copy" dangerouslySetInnerHTML={{ __html:`${email}`}}></div>
</Dialog>

The FormattedEmail component is a combination of different typography html tags

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!