mastodon-share

November 15, 2023 ยท View on GitHub

You can use this to create a share button. The body of the component can be arbitrary HTML.

When clicked, the component will open the instancepicker component and then redirect to the selected instance with the share dialog open.


<mastodon-share
        account="splitbrain@octodon.social"
        url="https://www.splitbrain.org"
        text="Check out Andi's homepage!"
>
    <button>Share this on Mastodon</button
</mastodon-share>

Note: the component will apply pointer-events: none to all top-level a elements to prevent the default click action. If you have a better idea on how to achieve this, please let me know.

Overview

A wrapper around any HTML which will share a page on the selected instance.

Properties

PropertyAttributeDescriptionTypeDefault
accountaccountunusedstringundefined
texttextThe text to share. Defaults to the current page's title.stringundefined
urlurlThe URL to share. Defaults to the current page.stringundefined

Dependencies

Depends on

Graph

graph TD;
  mastodon-share --> mastodon-instancepicker
  style mastodon-share fill:#f9f,stroke:#333,stroke-width:4px

Built with StencilJS