@servicensw/social
v3.0.5
Published
Social sharing component
Downloads
335
Maintainers
Keywords
Readme
@servicensw/social
A Social sharing widget that automatically creates sharing links for Facebook, Twitter, LinkedIn, WhatsApp, and email.
Service NSW package documentation and examples (Login credentials required)
Installation
npm install @servicensw/social --save-dev
How to use
CSS
- PostCSS workflow:
@import '@servicensw/social';
- Sass/Eyeglass:
@import 'servicensw-social';
- Native CSS:
@import url('dist/css/social.css');
- Link tag:
<link href="dist/css/social.css" rel="stylesheet" type="text/css">
Vanilla JS
- ES6 import:
import '@servicensw/social';
- Script tag:
<script src="dist/social-sharing.js" type="text/javascript"></script>
Vanilla JS is called on DOMContentLoaded
for the first #socialSharing
element.
Alternatively, initialise it manually for a specific CSS selector:
import SocialSharing from "@servicensw/social"
new SocialSharing("#socialSharing:not(.is-excluded)")
HTML
<div id="socialSharing" class="social-sharing"></div>