Skip to main content

Installation

mailgo is on npm / yarn, you can add it to any webpage with a CDN like unpkg or jsDelivr, downloading the script or through npm/yarn.

mailgo on npmmailgo npm bundle size

script in html

body

Add at the end of the <body>

<body>
...
<script src="https://unpkg.com/mailgo@0.12.2/dist/mailgo.min.js"></script>
</body>

Alternatively, you can import mailgo in <head> using defer or async

<head>
...
<script
src="https://unpkg.com/mailgo@0.12.2/dist/mailgo.min.js"
async
></script>
</head>

npm / yarn

Install mailgo with

npm install mailgo

or

yarn add mailgo

then import it

import mailgo from "mailgo";

and then you can call directly

mailgo();

to initialize mailgo in the page and substitute automatically all the mailto and tel when a user clicks (window object must be defined! If it's not so, please visit the SSR section).

BREAKING CHANGES from version 0.10.*: you can also use

const Mailgo = require("mailgo");

but then you have to call

Mailgo.start();

Configuration

mailgo() function accepts also the configuration object

function mailgo(mailgoConfig?: MailgoConfig): void;

you can find more about it here.


Alternatively you can import directly the script that fires on DOMContentLoaded event in this way:

import "mailgo/dist/mailgo.min.js";

or

require("mailgo/dist/mailgo.min.js");

standalone

Download the script here and add it your page in body or head

body

<body>
...
<script src="./path/to/mailgo.min.js"></script>
</body>

or

head

<head>
...
<script src="./path/to/mailgo.min.js" defer></script>
</head>

Dark mode

The dark mode is available through a configuration parameter (see more here) or substituting mailgo.min.js with mailgo.dark.min.js.

You can also specify dark mode only for single modals, to do this see here.