Pulsanti di condivisione leggeri, eleganti ed etici Piccoli. Senza dipendenze. Soli 6 KB Eleganti. Utilizzano i loghi vettoriali e i colori ufficiali senza disordine visivo. Etico. Non incorpora alcun codice di tracciamento. https://mastodon.uno
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Nikita Karamov c07f0138b9
10 months ago
.github Delete GitHub-specific files 10 months ago
assets Update logos and colours 10 months ago
src Update logos and colours 10 months ago
.editorconfig Convert code using Prettier 10 months ago
.eslintignore Remove Airbnb config in favour of the default one 10 months ago
.eslintrc.json Replace index loops with for-of-loops 10 months ago
.git-blame-ignore-revs Add .git-blame-ignore-revs 10 months ago
.gitignore Migrate to PNPM 10 months ago
.prettierignore Add Prettier as dependency 10 months ago
CHANGELOG.md v2.0.0 10 months ago
LICENSE Update year in LICENSE 10 months ago
README.md Add CHANGELOG entry and docs for CSS export 10 months ago
index.html Use non-default export 10 months ago
package.json v2.0.0 10 months ago
postcss.config.js Replace cssnano with CSSO 10 months ago
vite.config.js Use "node" protocol for import 10 months ago



Shareon logo — the Postal Horn emoji

Lightweight, stylish, and ethical share buttons

  • Small. Dependency-free. CSS+JS bundle is only 6 KB minified and gzipped.
  • Stylish. Uses official vector logos and colours with no visual mess.
  • Ethical. Embeds no tracking code. JS is required only for the setup.

Shareon demo screenshot

See the live demo at shareon.js.org


Simply load the needed files from the CDN:

  • defer makes sure Shareon is loaded after HTML is parsed
  • init will automatically initialize Shareon buttons

Do not auto-initialize

Remove the init attribute and initialize Shareon when you need it:


  // do something

Use ESM build

There is also a ESM build for the browsers, which doesn't support auto-initialization:

<script type="module">
  import { init } from "https://cdn.jsdelivr.net/npm/shareon@2/dist/shareon.es.js";
  // do something

Bundle with Node

You can also install Shareon using your favourite package manager and include it in your source files:

pnpm add shareon  # or `npm install`, or `yarn add`
import { init } from "shareon";
import "shareon/css"; // most bundlers will transpile this CSS


CommonJS imports are also supported:

const Shareon = require("shareon");
require("shareon/css"); // most bundlers will transpile this CSS



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>

Shareon will populate these <a> elements with correct href attributes.

Use with <button>s

You can use <button> (or any other element) instead of <a>s. In this case, Shareon will create an onclick-listener for each button. I do not recommend doing this, as this is not so good for semantics.

Share metadata

By default, the URL and the title of the active page will be shared. You can customize it with data- attributes. These can be applied on a specific button or on the whole .shareon container:

<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>

Apart from the URL and title, some networks support extra parameters:

  • you MUST add data-fb-app-id to the FB Messenger button to make sharing even possible
  • add data-media to an Odnoklassniki, Pinterest, or VK button to customize the pinned picture
  • add data-text to a WhatsApp, Mastodon, Telegram, or Viber button to add custom message text
  • add data-via to a Twitter or Mastodon button to mention a user

Here are all custom parameters:

<div class="shareon" data-url="https://custom.url/for-this-page">
  <a class="facebook" data-title="Custom Facebook title"></a>
  <a class="messenger" data-fb-app-id="0123456789012345"></a>
  <a class="pinterest" data-media="https://custom.picture/for-pinterest">Pin</a>
  <a class="telegram" data-text="Check this out!"></a>
  <a class="twitter" data-via="MyNickname"></a>
  <a class="mastodon" data-via="@MyNickname@myserver.social"></a>
  <a class="whatsapp" data-url="https://custom.url/for-whatsapp">Send</a>

Other versions


Copyright © 2020–2022 Nikita Karamov
Licenced under the MIT License.

Shareon was heavily inspired by Likely, and has a somewhat backwards-compatible API (excluding themes and sizes). Likely is licenced under the MIT License.

Shareon's logo is the Postal Horn emoji from Noto Emoji. Noto Emoji is licenced under the Apache License v2.0.

Share icons are being sourced from Simple Icons. Simple Icons is released under CC0, but the icons themselves may be subject to copyright of the respective owners.

This project is hosted on Codeberg: https://codeberg.org/kytta/shareon