<social-sharer>

Example

Usage

<social-sharer url="https://www.creativebloq.com/features/web-components"></social-sharer>

Description

When repeating common patterns and there is no native equivilant available, it may be worth looking into creating a custom element.

A custom element is written in JavaScript and loaded into the page. It is then used like any other HTML element and acts just the same.

This example creates a <social-sharer> element. When passed a URL it generates a link to share it on Facebook, Twitter and LinkedIn.

To see how it works, take a look at the custom element class.