Shareon logo — the Postal Horn emoji

Shareon

Lightweight, stylish, and ethical share buttons

What is it?

Shareon are share buttons for popular social networks.

Unlike many other share buttons, Shareon are:

The whole JavaScript code is quick and simple: it only populates the buttons with share links. This makes Shareon the perfect choice for your blog, news site, or project page!

Install

Simply load the needed files from the CDN:

<link 
  href="https://cdn.jsdelivr.net/npm/shareon@2/dist/shareon.min.css"
  rel="stylesheet"
>
<script
  src="https://cdn.jsdelivr.net/npm/shareon@2/dist/shareon.iife.js"
  defer
  init
></script>

or install it via NPM and bundle it in a JS file:

import * as Shareon from "shareon";
import "shareon/css";

Shareon.init();

Usage

Create a container with class shareon and populate it with elements, class names of which match the names of the social networks:

<div class="shareon">
    <a class="facebook"></a>
    <a class="linkedin"></a>
    <a class="mastodon"></a>
    <!-- FB App ID is required for the Messenger button to function -->
    <a class="messenger" data-fb-app-id="0123456789012345"></a>
    <a class="odnoklassniki"></a>
    <a class="pinterest"></a>
    <a class="pocket"></a>
    <a class="reddit"></a>
    <a class="telegram"></a>
    <a class="twitter"></a>
    <a class="viber"></a>
    <a class="vkontakte"></a>
    <a class="whatsapp"></a>
    <a class="copy-url"></a>
</div>

You can customize the shared URL and page title with data- attributes:

<div class="shareon" data-url="https://custom.url/for-this-page">
    <a class="facebook" data-title="Custom Facebook title"></a>
    <a class="twitter" data-title="Custom Twitter title"></a>
</div>

Read more in the README on GitHub!