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

228
Views
Open link in a new tab when button is clicked

I want it to open in a new tab when the link in my hello button is clicked, how can I get it?

My Code:

 <Button
          href="https://play.google.com/store/apps/dev?id=6411367502435954294"
          type="primary"
          content="Play Store ๐Ÿ›’"
        />

All Code :

import styles from "./contact.module.scss";
import Button from "../Button/Button";
import Social from "../Social/Social";

const Contact = () => {
  return (
    <div className={styles.contactWrapper}>
      <div className={styles.socialWrapper}>
        <Social
          media="linkedin"
          href="https://www.linkedin.com/in/nisaefendioglu/"
        />
        <Social media="github" href="https://github.com/nisaefendioglu" />
        <Social media="twitter" href="https://twitter.com/nisaefendioglu" />
      </div>
      <div className={styles.buttonWrapper}>
        <Button
          href="https://play.google.com/store/apps/dev?id=6411367502435954294"
          type="primary"
          content="Play Store ๐Ÿ›’"
        />
        <Button
          href="mailto:nisaefendioglu0@gmail.com"
          type="secondary"
          content="Contact"
          icon={"paper-plane"}
        />
      </div>
    </div>
    
  );
};

export default Contact;

SCSS

.buttonWrapper {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, 20rem);
  justify-content: center;
  align-items: center;
  gap: var(--medium-space);
}

Button :

import styles from "./button.module.scss";

const Button = ({ content, icon, type, href }) => {
  return (
    <>
      <a
        className={`${styles.button} ${
          type === "primary" ? styles.primaryButton : styles.secondaryButton
        }`}
        href={href}
      >
        <i className={`fas fa-${ icon }`}></i>
        {content}
      </a>
    </>
  );
};

export default Button;
about 4 years ago ยท Santiago Trujillo
1 answers
Answer question

0

UPDATED CODE

Add a target="_blank" attribute

<Button
  target="_blank"
  href="https://play.google.com/store/apps/dev?id=6411367502435954294"
  type="primary"
  content="Play Store ๐Ÿ›’"
>
  {/*some code*/}
</Button>;

import styles from "./button.module.scss";

/* Include additional prop target in your button component */

const Button = ({ content, icon, type, href, target }) => {
  return (
    <>
      <a
        target={target}
        className={`${styles.button} ${
          type === "primary" ? styles.primaryButton : styles.secondaryButton
        }`}
        href={href}
      >
        <i className={`fas fa-${icon}`}></i>
        {content}
      </a>
    </>
  );
};

export default Button;
about 4 years ago ยท Santiago Trujillo 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!