@slushman/share-button
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

@slushman/share-button

An HTML button that opens a native share sheet or copies the sharing message to your clipboard.

Installation

Install with your preferred package manager.

yarn add @slushman/share-button
or
npm install @slushman/share-button

Dependencies

  • React
  • css.gg
  • Tailwind

Example usage

import { ShareButton } from "@slushman/share-button";

<ShareButton
  shareContent="Example share content that can be as long as you prefer."
  shareTitle="Example Title"
/>;

Props

classes

Optional object to customize the Tailwind classes on each element. The options are:

  • button
  • icon

buttonLabel

Optional label for the button. The default value is 'Share'.

onCopyToClipboard

Optional function that runs if the device does not have a native share sheet. In this case, the shareContent is copied to the clipboard, then this function runs.

onNoShare

Optional function that runs if the device does not neither a native share sheet nor a cliboard.

shareContent

Required string. The content shared in the share sheet or clipboard.

shareTitle

Required string. The title used for the share sheet.

Readme

Keywords

none

Package Sidebar

Install

npm i @slushman/share-button

Weekly Downloads

0

Version

1.1.0

License

none

Unpacked Size

176 kB

Total Files

8

Last publish

Collaborators

  • chriswilcoxson