npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-share-utilities

v0.0.5

Published

React sharing utilities with clipboard, social share, and deep link support

Readme

React Share Utilities

Lightweight React helpers for sharing content, copying to clipboard, and opening deep links with smart fallbacks. Built with TypeScript types, zero runtime dependencies, and drop-in components.

  • Docs: https://react-share.sudarshankakde.tech/
  • NPM: https://www.npmjs.com/package/react-share-utilities

Installation

npm install react-share-utilities

Or using yarn:

yarn add react-share-utilities

Or using pnpm:

pnpm add react-share-utilities

Works with React 18+ and 19+. Browser-only (uses navigator).

Quick Start

import { useShare } from "react-share-utilities";

export default function Example() {
  const { share, isSharing, status, error } = useShare();

  return (
    <button
      disabled={isSharing}
      onClick={() =>
        share({
          url: "https://example.com",
          title: "Hello world",
          text: "Check this out!",
        })
      }
    >
      {status === "sharing" ? "Sharing…" : "Share"}
    </button>
  );
}

Components

ShareButton

Simplest way to trigger native share with fallback.

import { ShareButton } from "react-share-utilities";

<ShareButton
  data={{ url: "https://example.com", title: "Hello", text: "Check this out" }}
  variant="solid"
  color="primary"
  onSuccess={(info) => console.log("shared via", info.method)}
/>;

CopyToClipboard

import { CopyToClipboard } from "react-share-utilities";

<CopyToClipboard
  data="https://example.com"
  label="Copy link"
  successLabel="Copied!"
  variant="outline"
/>;

SocialShareButton

Generate and open platform URLs (X, Facebook, LinkedIn, Reddit, WhatsApp, Telegram, Email, etc.).

import { SocialShareButton } from "react-share-utilities";

<SocialShareButton
  platform="twitter"
  params={{
    url: "https://example.com",
    title: "A great article",
    via: "yourhandle",
    hashtags: ["react", "sharing"],
  }}
  label="Share on X"
/>;

DeepLinkOpen

Open native apps with graceful web fallback.

import { DeepLinkOpen } from "react-share-utilities";

<DeepLinkOpen
  url="https://open.spotify.com/playlist/123"
  label="Open in Spotify"
  options={{ fallbackToWeb: true, fallbackDelay: 2000 }}
  onOpened={({ deepLink, os }) => console.log("opened for", os, deepLink)}
/>;

ShareFallbackModal

UI modal you can show when native sharing is unavailable. (Import and render when method === 'fallback' from useShare.)

import { ShareFallbackModal } from "react-share-utilities";

Hooks

useShare(options)

  • Native navigator.share when available; falls back to clipboard or custom function.
  • Returns helpers: share, handleShare, copyToClipboard, openSocialShare, socialUrl, detectPlatform, detectOS, plus status flags.
  • Options: timeout, preferNative, fallback ("clipboard" | "none" | custom fn), toast handlers, messages, onSuccess, onError.

useClipboard(options)

  • copyToClipboard(text) with status flags and optional fallback.

useSupports()

  • Feature detection for navigator.share, navigator.canShare, and clipboard.

Utilities

  • openLink(url, opts) – deep link with fallback to web.
  • generateDeepLink(url) – map common URLs to app schemes.
  • buildSocialUrl(platform, params) – build share URLs for platforms.
  • detectOS() and detectPlatform(url) helpers.
  • safeNavigator() – guard for SSR/unsupported envs.

Props & Types

Key types are exported: ShareInput, UseShareOptions, UseClipboardReturn, UseShareReturn, SocialPlatform, SocialParams, DeepLinkPlatform, OpenLinkOptions, Variant, Color, Size, and icon maps ICONS, LOGOS, SHARE_BUTTON_ICONS, COPY_TO_CLIPBOARD_ICONS.

Styling

Components ship with minimal inline styles; you can style via className, variant, color, and size. Icon sets are exported if you want to build custom buttons.

Examples & Docs

Full docs, live demos, and more recipes: https://react-share.sudarshankakde.tech/

License

This project is licensed under the MIT License.