@rafael-vitor/react-web-share
TypeScript icon, indicating that this package has built-in type declarations

1.0.18 • Public • Published

react-web-share

Tiny Web Share API wrapper with fallback for unsupported browsers

GitHub Actions Status NPM gzip

Edit react-web-share

💡 most browsers restricts web share api only to https websites

Features

  • 🍃 Only ~3kb gzipped and no external dependencies
  • 🌀 Uses React Portal
  • Written w/ TypeScript

🔧 Installation

npm i react-web-share    # npm
yarn add react-web-share # yarn

Preview

Mobile

Mobile Preview

Desktop

Desktop Preview

📦 Example

import React, { useState } from "react";
import { RWebShare } from "react-web-share";

const Example = () => {
  return (
    <div>
      <RWebShare
        data={{
          text: "Like humans, flamingos make friends for life",
          url: "https://on.natgeo.com/2zHaNup",
          title: "Flamingos",
        }}
      >
        <button>Share 🔗</button>
      </RWebShare>
    </div>
  );
};

export default Example;

👀 Props

Prop Description Type Default
data Share Object {text, url, title} {text: "", url: currentURL, title: "Share"}
sites sites string[] all platforms (see list below for key list)

🌎 Sites

  • facebook
  • twitter
  • whatsapp
  • reddit
  • telegram
  • linkedin
  • mail
  • copy (Copy to Clipboard)

🤠 Credits

📜 License

MIT © harshzalavadiya

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.181latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.181

Package Sidebar

Install

npm i @rafael-vitor/react-web-share

Weekly Downloads

0

Version

1.0.18

License

MIT

Unpacked Size

99.3 kB

Total Files

30

Last publish

Collaborators

  • rafael-vitor