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 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-simple-share

v0.1.2

Published

React component buttons that open popups to share your link on Facebook, Twitter, Reddit, Pinterest, LinkedIn, and Google+, without the client downloading heavy third-party sharing dependencies.

Downloads

113

Readme

react-simple-share

NPM

npm version Download Count

Add social media sharing buttons to your React app for a number of popular social media sites.

This component leverages the URL sharing features of each service, so no third-party code needs to be loaded. This results in less network requests and a better loading experience for your users.

Supported networks:

  • Facebook
  • Twitter
  • Tumblr
  • Reddit
  • Pinterest
  • LinkedIn
  • Google+

By default, the buttons will share the link to the current page. However, you can pass in a custom prop for a specific URL instead (along with some other customization options, too).

Installation

Use npm to install:

npm install react-simple-share --save

Or, if you're using yarn:

yarn add react-simple-share

Quick Examples

Single button

Single button

import { FacebookShareButton } from "react-simple-share";

const SingleButtonDemo = () => <FacebookShareButton />;

Basic use with all supported networks included

Basic use with all supported networks included

import { SimpleShareButtons } from "react-simple-share";

const BasicUsageDemo = () => <SimpleShareButtons />;

Monochromatic with custom size

Monochromatic with custom size

import { SimpleShareButtons } from "react-simple-share";

const MonochromaticDemo = () => (
  <SimpleShareButtons color="#37474F" size="40px" />
);

Whitelist of selected networks

Whitelist of selected networks

import { SimpleShareButtons } from "react-simple-share";

const WhitelistDemo = () => (
  <SimpleShareButtons
    whitelist={["Facebook", "Twitter", "LinkedIn", "Google+"]}
  />
);

API by Component

<SimpleShareButtons />

Examples

import { SimpleShareButtons } from "react-simple-share";

const BasicExample = () => <SimpleShareButtons />;

const OptionsExample = () => (
  <SimpleShareButtons
    url="https://github.com/swozniak/react-simple-share"
    color="#03A9F4"
    size="80px"
  />
);

const WhitelistExample = () => (
  <SimpleShareButtons
    whitelist={[
      "Facebook",
      "Twitter",
      "LinkedIn",
      "Google+"
  />
);

Supported Props

| Prop | Default value | Description | | ------------- | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | url | Current page the user is on (window.location.href). | The URL to use in the share dialog. | | color | Hex code for a primary branding color of that service. | A 3-character or 6-character hex code. Include the "#". | | size | "32px" | The size to render the icon. Any units accepted by the CSS property font-size will work here. | | whitelist | ["Facebook", "Twitter", "Tumblr", "Reddit", "Pinterest", "LinkedIn", "Google+"] | By default, this component will render a share button for each social network supported by this module. If you only want to render share buttons for specific sites, pass in an array populated with the names of those sites. | | | | |

<FacebookShareButton />

Examples

import { FacebookShareButton } from "react-simple-share";

const BasicExample = () => <FacebookShareButton />;

const OptionsExample = () => (
  <FacebookShareButton
    url="https://github.com/swozniak/react-simple-share/"
    color="#3B5998"
    size="40px"
  />
);

Supported Props

| Prop | Default value | Description | | --------- | ------------------------------------------------------ | ----------------------------------------------------------------------------------------------- | | url | Current page the user is on (window.location.href). | The URL to use in the share dialog. | | color | Hex code for a primary branding color of that service. | 3-character or 6-character hex code. Include the "#". | | size | "32px" | The size to render the icon. Any units accepted by the CSS property font-size will work here. | | | | |

<TwitterShareButton />

Examples

import { TwitterShareButton } from "react-simple-share";

const BasicExample = () => <TwitterShareButton />;

const OptionsExample = () => (
  <TwitterShareButton
    url="https://github.com/swozniak/react-simple-share/"
    color="#1DA1F2"
    size="40px"
    text="Add social media sharing buttons to your React app with react-sample-share by @stephanwozniak!"
    hashtags="reactsimpleshare,javascript,react"
    via="github"
    related="stephanwozniak,chillective"
  />
);

Supported Props

| Prop | Default value | Description | | ------------ | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | | url | Current page the user is on (window.location.href). | The URL to use in the share dialog. | | color | Hex code for a primary brand color of that service. | A 3-character or 6-character hex code. Include the "#". | | size | "32px" | The size to render the icon. Any units accepted by the CSS property font-size will work here. | | text | Title of the current page (document.title). | Default tweet text, which the user can edit before posting. | | hashtags | Ignored by default. | Comma-separated string of hashtags to append to the end of the tweet. | | via | Ignored by default. | Twitter username for the source of the content (or your site). | | related | Ignored by default. | Comma-separated string of Twitter usernames for other accounts which may be suggested to the user after publishing their tweet. | | | | |

<TumblrShareButton />

Examples

import { TumblrShareButton } from "react-simple-share";

const BasicExample = () => <TumblrShareButton />;

const OptionsExample = () => (
  <TumblrShareButton
    url="https://github.com/swozniak/react-simple-share/"
    color="#35465D"
    size="40px"
    title="React Simple Share - by @stephanwozniak"
    caption="Check out this free React Component by @stephanwozniak, made for easily sharing pages on social media sites!"
    tags="reactsimpleshare,javascript,react"
  />
);

Supported Props

| Prop | Default value | Description | | ----------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------- | | url | Current page the user is on (window.location.href). | The URL to use in the share dialog. | | color | Hex code for a primary brand color of that service. | A 3-character or 6-character hex code. Include the "#". | | size | "32px" | Size to render the icon. Any units accepted by the CSS property font-size will work here. | | title | Title of the current page (document.title). | Default title text, which the user can edit before posting. | | caption | Ignored by default. | Default post text, which the user can edit before posting. | | tags | Ignored by default. | Comma-separated string of tags to append to the end of the post. | | | | |

<PinterestShareButton />

Examples

import { PinterestShareButton } from "react-simple-share";
const BasicExample = () => <PinterestShareButton />;
const OptionsExample = () => (
  <PinterestShareButton
    url="https://github.com/swozniak/react-simple-share/"
    color="#BD081C"
    size="40px"
    description="Check out this free React Component by @stephanwozniak, made for easily sharing pages on social media sites!"
    media="https://avatars3.githubusercontent.com/u/2192011?s=460&v=4"
  />
);

Supported Props

| Prop | Default value | Description | | --------------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------- | | url | Current page the user is on (window.location.href). | The URL to use in the share dialog. | | color | Hex code for a primary brand color of that service. | A 3-character or 6-character hex code. Include the "#". | | size | "32px" | Size to render the icon. Any units accepted by the CSS property font-size will work here. | | description | Ignored by default. | Default post text, which the user can edit before posting. | | media | Ignored by default. | Absolute URL path to an image to post with this pin. | | | | |

<RedditShareButton />

Examples

import { RedditShareButton } from "react-simple-share";

const BasicComponent = () => <RedditShareButton />;
const OptionsComponent = () => (
  <RedditShareButton
    url="https://github.com/swozniak/react-simple-share/"
    color="#336699"
    size="40px"
    title="Simple Share - a free react component by @stephanwozniak, made for easily sharing links on social media sites!"
  />
);

Supported Props

| Prop | Default value | Description | | --------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------- | | url | Current page the user is on (window.location.href). | The URL to use in the share dialog. | | color | Hex code for a primary brand color of that service. | A 3-character or 6-character hex code. Include the "#". | | size | "32px" | Size to render the icon. Any units accepted by the CSS property font-size will work here. | | title | Title of the current page (document.title). | Default title text, which the user can edit before posting. | | | | |

<LinkedInShareButton />

Examples

import { LinkedInShareButton } from "react-simple-share";

const BasicComponent = () => <LinkedInShareButton />;
const OptionsComponent = () => (
  <LinkedInShareButton
    url="https://github.com/swozniak/react-simple-share/"
    color="#007BB5"
    size="40px"
    title="React Simple Share"
    summary="A free react component by @stephanwozniak, made for easily sharing links on social media sites!"
  />
);

Supported Props

| Prop | Default value | Description | | ----------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------- | | url | Current page the user is on (window.location.href). | The URL to use in the share dialog. | | color | Hex code for a primary brand color of that service. | A 3-character or 6-character hex code. Include the "#". | | size | "32px" | Size to render the icon. Any units accepted by the CSS property font-size will work here. | | title | Title of the current page (document.title). | Default title text, which the user cannot edit before posting. | | summary | Ignored by default. | Default post text, which the user can edit before posting. | | | | |

<GooglePlusShareButton />

Examples

import { GooglePlusShareButton } from "react-simple-share";

const BasicComponent = () => <GooglePlusShareButton />;
const OptionsComponent = () => (
  <GooglePlusShareButton
    url="https://github.com/swozniak/react-simple-share/"
    color="#DB4437"
    size="40px"
  />
);

Supported Props

| Prop | Default value | Description | | --------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------- | | url | Current page the user is on (window.location.href). | The URL to use in the share dialog. | | color | Hex code for a primary brand color of that service. | A 3-character or 6-character hex code. Include the "#". | | size | "32px" | Size to render the icon. Any units accepted by the CSS property font-size will work here. | | | | |

License

MIT. See LICENSE.md for details.