Skip to content

MauricioRobayo/react-obfuscate-email

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

React Obfuscate Email

React Obfuscate Email

πŸ“§πŸš«πŸ€– Lightweight email obfuscator React component.

Until you hover or focus on the link, the @ symbol is stripped out and rendered using ::after css pseudo-element, and the href attribute value is replaced with #.

Installation

npm install --save react-obfuscate-email

Usage

import { Email } from "react-obfuscate-email";

export default function SomeComponent() {
  return <Email email="[email protected]">πŸ“§ Email me!</Email>;
}

Examples

Inspect the element without hovering or focusing on it to see what's actually rendered:

<Email
  email="[email protected]"
  body="You rock!"
  subject="Hi πŸ‘‹"
  cc={["[email protected]", "[email protected]"]}
  bcc={["[email protected]"]}
>
  πŸ“§ Click me!
</Email>

You can pass any children to control the displayed text of the link:

<Email email="[email protected]">πŸ“§ Click me!</Email>

You can pass any valid a tag attributes, like target or title:

<Email
  email="[email protected]"
  title="πŸ“§ Email me!"
  target="_blank"
  rel="noopener noreferrer"
>
  πŸ“§ Email me!
</Email>

Props

Name Type Required Default Description
email string Yes β€” E-mail recipient address
children ReactNode No email Content to display in the link
subject string No "" Subject of e-mail
body string No "" Body of e-mail
cc string[] No [] Carbon copy e-mail addresses
bcc string[] No [] Blind carbon copy e-mail addresses
...props AnchorHTMLAttributes No β€” Any valid tag attribute (e.g. target, rel, title)

TypeScript

The component is written in TypeScript and type definitions are included.

License

MIT

Show your support

Give a ⭐️ if you like this project!

LICENSE

MIT

About

πŸ“§ Hide email addresses from bots

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •