---
title: Adding New Social Sharing Platforms
description: Instructions on how to add new platforms to the social sharing component.
js: ./js/social/bonsai.socialbase.js
---

### How to use

Ensure that you create a new class that inherits `BonsaiSocialBase` and override class properties as necessary.

Example:
```
import { BonsaiSocialBase } from "./bonsai.socialbase";

class BonsaiTwitter extends BonsaiSocialBase {
    constructor(container) {
        super(container);

        this.accessibleText = "Share with Twitter";

        this.buttonDataAttribute = "data-twitter-share";
        this.iconClass = "icon-twitter";
        this.buttonBackgroundColor = "twitter-blue-background";

        this.text = encodeURIComponent(document.title);
        this.shareUrl = `https://twitter.com/share?url=${this.currentUrl}&text=${this.text}`;
        this.windowName = "Twitter";
    }
}

export { BonsaiTwitter };
```
