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-share-pro

v2.1.9-24

Published

Boost your React applications with react-share-pro, a customizable library for adding social media sharing buttons. Share effortlessly on Facebook, Twitter, LinkedIn, Reddit, and WhatsApp with beautiful, responsive buttons. Enhance user engagement and dri

Downloads

487

Readme

Welcome to react-share-pro 👋

npm version node version CDNJS install size Gitpod Ready-to-Code Build status npm bundle size downloads License Known Vulnerabilities

Introduction

react-share-pro is a powerful library for adding customizable social media sharing buttons to your React applications, enabling seamless sharing of content across popular platforms .

Table of Contents

Features

  • no external script loading, i.e. no dependencies on SDKs
  • supports tree shaking with ES modules
  • use own style pop-up window
  • share buttons for:
    • Facebook
    • Twitter
    • Email
    • Instagram

Installation

You can install react-share-pro via npm or yarn:

npm install react-share-pro

or

yarn add react-share-pro

Version Information

Current Version: 2.1.8

This is an alpha version of react-share-pro. It includes the latest features and improvements but may also contain bugs or unfinished functionality. We encourage developers to test this version but recommend using it in non-production environments.

Previous Stable Version: 2.1.5

If you prefer stability over new features, you may choose to use the latest stable version. It is well-tested and suitable for production environments. You can install it by running:

Usage

To use react-share-pro, import the desired components and render them in your React application. Below is a basic example:

Basic Example

import React from "react";
import {
	FacebookShareButton,
	TwitterShareButton,
	EmailShareButton,
} from "react-share-pro";

const ShareComponent = () => {
	const shareUrl = "https://yourwebsite.com";
	const shareText = "Check out this amazing website!";
	const isDefault = true;
	return (
		<div>
			<h2>Share this page:</h2>
			<FacebookShareButton url={shareUrl} text={shareText} isDefault={isDefault}>
				Share on Facebook
			</FacebookShareButton>
			<TwitterShareButton url={shareUrl} text={shareText} isDefault={isDefault}>
				Share on Twitter
			</TwitterShareButton>
			<EmailShareButton
				subject='Amazing Website'
				body='Check out this amazing website!'
				isDefault={isDefault}>
				Share via Email
			</EmailShareButton>
		</div>
	);
};

export default ShareComponent;

Available Components

react-share-pro includes the following components:

  • FacebookShareButton: A button to share on Facebook.
  • TwitterShareButton: A button to share on Twitter.
  • EmailShareButton: A button to share on Email.
  • InstagramShareButton: A button to share on Instagram.

Customization

react-share-pro customize the buttons by applying your own styles and configurations. Here’s how you can enhance the appearance and behavior of your buttons:

Custom Children

You can pass any React node as children to the share buttons, allowing you to use custom images, SVGs, or text. This gives you the flexibility to design buttons that fit your application's branding.

Example

import React from "react";
import FacebookIcon from "./icons/facebook-icon.png"; // Assuming you have a PNG icon

const ShareComponent = () => {
	const shareUrl = "https://yourwebsite.com";
	const shareText = "Check out this amazing website!";

	return (
		<div>
			<h2>Share this page:</h2>
			<FacebookShareButton url={shareUrl} text={shareText} isDefault={false}>
				<img
					src={FacebookIcon}
					alt='Facebook'
					style={{ width: "20px", marginRight: "5px" }}
				/>
				Share on Facebook
			</FacebookShareButton>
		</div>
	);
};

export default ShareComponent;

costum CSS Example

.share-button {
	background-color: #3b5998; /* Facebook blue */
	color: white;
	padding: 10px 15px;
	border-radius: 5px;
	text-align: center;
	cursor: pointer;
	transition: background-color 0.3s;
}

.share-button:hover {
	background-color: #365e8a; /* Darker Facebook blue */
}

Applying Custom Styles

You can apply these styles in your components like this:

<FacebookShareButton
	className='share-button'
	url={shareUrl}
	title={title}
	isDefault={false}>
	Share on Facebook
</FacebookShareButton>

Props

Each react-share-pro component accepts specific props:

FacebookShareButton

  • url (string): The URL you want to share or window.location.href .
  • text (string): The title for the shared content.

TwitterShareButton

  • url (string): The URL you want to share or window.location.href.
  • text (string): The title for the shared content.

EmailShareButton

  • subject (string): The subject line for the email.
  • body (string): The body content of the email.

InstagramShareButton

  • text (string): The text content for the instagram.

Common Props (optional)

  • children (node): The content inside the button (can be text or an icon).
  • className (string, optional): Custom CSS class for additional styling.
  • tab (string, optional): The target for the email link (default is '_blank').
  • isDefault (boolean): Whether to use the default Facebook share button or a custom one

Examples

Facebook Share Example

<FacebookShareButton url='https://yourwebsite.com' text='Check this out!'>
	Share on Facebook
</FacebookShareButton>

Email Share Example

<EmailShareButton
	subject='Amazing Website'
	body='Check out this amazing website!'>
	Share via Email
</EmailShareButton>

License

This project is licensed under the MIT License. See the LICENSE file for more information.

Contributing

We welcome contributions! Please read our CONTRIBUTING.md for guidelines on how to get started.

Issues

If you encounter any issues, please read our ISSUES.md for guidlines how to submit a issue .

New_Feature

We welcome contributing a new feature to react-share-pro Please read our NEW_FEATURE.md for guidelines for how to propose a new feature.

Contact

For any questions or feedback, please reach out to [[email protected]].