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

113
Views
reactJS copy to clipboard

I wonder if something like this is doable in reactjs (i'm new). In this example, when user hovers over the email address (at the bottom), it says: copy to clipboard, once clicked, email is copied.

https://shapefarm.net/contact/

I have the styling, once hovered, the text appears, but I really don't know how to implement the functionality, any ideas? Thank you!

    const Footer = () => {
  return (
    <>
        <FooterContainer>
            <FooterBg>
        
              <div className="footer-wrapper">
                <div className="info">
                  
                  
                  
                  
                  <div className="hovertext-container">
                    <p className="hovertext-p1">
                      mymail@test.com
                    </p>
                    <p className="hovertext-p2">copy to clipboard</p>
                  </div>
                  
                  
                </div>
                <div>
                  <SocialMedia />
                </div>
                
              </div>
            </FooterBg>
        </FooterContainer>
    </>
  )
}

export default Footer 
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

A simple

onClick={() => {navigator.clipboard.writeText(this.state.textToCopy)}}

is going to do the job, you can also try out this npm package.

about 4 years ago · Juan Pablo Isaza Report

0

    const Footer = () => {
let email = "mymail@test.com";
  return (
    <>
        <FooterContainer>
            <FooterBg>
        
              <div className="footer-wrapper">
                <div className="info">
                  
                  
                  
                  
                  <div className="hovertext-container">
                    <p className="hovertext-p1">
                      mymail@test.com
                    </p>
                    <p onClick={async () => {
                await navigator.clipboard.writeText(email)
                alert("Copied text!")
                }}
                    className="hovertext-p2">copy to clipboard</p>
                  </div>
                  
                  
                </div>
                <div>
                  <SocialMedia />
                </div>
                
              </div>
            </FooterBg>
        </FooterContainer>
    </>
  )
}

export default Footer 

about 4 years ago · Juan Pablo Isaza Report
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!