How to Install ShareThis Module for Your Angular App

We’re happy to announce that ShareThis has built its own module for Angular! Follow the directions below to learn how you can install Sharethis inline and sticky share buttons onto your Angular apps/sites.

The Angular module for ShareThis buttons are available within our Git repository, from NPMjs or you can initiate via angular cli. 

  1. Initiate your project (Skip if you already have it). If you don’t have angular cli, you can download it here: After downloaded, run the following command to create your project:
    ng new <project-name>
  2. Install sharethis-angular dependency: Go to your project folder:
    cd <project-name>
  3. Run the following command:
    npm i sharethis-angular
  4. Finish installation and add the module: Once you’ve completed installation, go to:
  • You will need to:
    • import SharethisAngularModule from sharethis-angular
    • add SharethisAngularModule to imports

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { SharethisAngularModule } from 'sharethis-angular';

  declarations: [
  imports: [
  providers: [],
  bootstrap: [AppComponent]
export class AppModule { }

5. Start customizing via components: Now go to

6. Create config for share buttons: Copy the InlineShareButtonsConfig below and create a config. We recommend storing the config in a separate file and import into the component you wish to use. Then all you will need to do is pass it to the component property. 


The Share Count is linked to the URL, if no URL is provided in the configuration attributes, it will use the URL where the buttons are located. Remember to customize or remove the URL in the example below.

import { Component, OnInit } from '@angular/core';

const InlineShareButtonsConfig = {
  alignment: 'center', // alignment of buttons (left, center, right)
  color: 'social', // set the color of buttons (social, white)
  enabled: true, // show/hide buttons (true, false)
  font_size: 16, // font size for the buttons
  labels: 'cta', // button labels (cta, counts, null)
  language: 'en', // which language to use (see LANGUAGES)
  networks: [
    // which networks to include (see SHARING NETWORKS)
  padding: 12, // padding within buttons (INTEGER)
  radius: 4, // the corner radius on each button (INTEGER)
  show_total: true,
  size: 40, // the size of each button (INTEGER)
  url: '', // (defaults to current url)
  image: '', // (defaults to og:image or twitter:image)
  description: 'custom text', // (defaults to og:description or twitter:description)
  title: 'custom title', // (defaults to og:title or twitter:title)
  message: 'custom email text', // (only for email sharing)
  subject: 'custom email subject', // (only for email sharing)
  username: 'custom twitter handle', // (only for twitter sharing)

  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css'],

export class AppComponent {
  inlineShareButtonsConfig = InlineShareButtonsConfig;

7. Add code to HTML: Now setup the html, go to:
Add the following:


You can also set up other share buttons like below




8. The last step is to run:
ng serve

9. Now view within the browser, go to: http://localhost:4200/ and the buttons should now appear.