Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@clipchamp/react-share

Package Overview
Dependencies
Maintainers
11
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@clipchamp/react-share

Social media share buttons and share counts for React.

  • 3.0.0-a
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
Maintainers
11
Weekly downloads
 
Created
Source

react-share

npm version Download Count

Social media share buttons and share counts for React.

Share buttons and counts example

Migrating from v2 to v3? Read changelog.

Migrating from v1 to v2? Read migration notes.

Features

  • no external script loading, i.e. no dependencies on SDKs
  • opens a popup share-window
  • share buttons for:
    • Facebook
    • Twitter
    • Telegram
    • Whatsapp
    • LinkedIn
    • Pinterest
    • VK
    • Odnoklassniki
    • Reddit
    • Tumblr
    • Mail.Ru
    • LiveJournal
    • Viber
    • Workplace
    • Line
    • Weibo
    • Pocket
    • Instapaper
    • email
  • share counts for
    • Facebook
    • Pinterest
    • VK
    • Odnoklassniki
    • Reddit
    • Tumblr
  • social media icons included in the library
  • supports also custom icons
Demo

View demo

To run demo: clone repo and run npm install && npm run run-demos and open http://localhost:8080.

Install

npm install react-share --save

Browser

ShareButtons work on all browsers.

ShareCounts works on all browsers.

Compatibility

Version 1.x.x: compatible with React versions 0.13.x, 0.14.x and 15.x.x.

Version 2.x.x: comptiblity is tested with React 15 and 16.

Version 3.x.x: comptiblity is tested with React 15 and 16.

API

Share buttons

import {
  FacebookShareButton,
  LinkedinShareButton,
  TwitterShareButton,
  TelegramShareButton,
  WhatsappShareButton,
  PinterestShareButton,
  VKShareButton,
  OKShareButton,
  RedditShareButton,
  TumblrShareButton,
  LivejournalShareButton,
  MailruShareButton,
  ViberShareButton,
  WorkplaceShareButton,
  LineShareButton,
  PocketShareButton,
  InstapaperShareButton,
  EmailShareButton,
  FacebookMessengerShareButton,
} from 'react-share';
Share button props
Required propsOptional props
Allchildren: A React node (e.g. string or element)
url: URL of the shared page (string)
disabled: Disables click action and adds disabled class (bool)
disabledStyle: Style when button is disabled (object, default = { opacity: 0.6 })
windowWidth, windowHeight: opened window dimensions (int, different defaults for all share buttons)
beforeOnClick: Takes a function that returns a Promise to be fulfilled before calling onClick. If you do not return promise, onClick is called immediately.
onShareWindowClose: Takes a function to be called after closing share dialog.
additionalProps: An object to pass any additional properties, such as aria-* attributes. Provides an override possibility for the default aria-label.
FacebookShareButton-quote: A quote to be shared along with the link. (string)
hashtag: A hashtag specified by the developer to be added to the shared content. People will still have the opportunity to remove this hashtag in the dialog. The hashtag should include the hash symbol. (string)
LinkedinShareButton--
TwitterShareButton-title: Title of the shared page (string)
via: (string)
hashtags: (array)
TelegramShareButton-title: Title of the shared page (string)
WhatsappShareButton-title: Title of the shared page (string)
separator: Separates title from the url, default: " " (string)
PinterestShareButtonmedia: An absolute link to the image that will be pinned (string)description: Description for the shared media.
VKShareButton-title: Title of the shared page (string)
description: Description of the shared page (string)
image: An absolute link to the image that will be shared (string)
OKShareButton-title: Title of the shared page (string)
description: Description of the shared page (string)
image: An absolute link to the image that will be shared (string)
RedditShareButton-title: Title of the shared page (string)
TumblrShareButton-title: Title of the shared page (string)
tags: (array)
caption: Description of the shared page (string)
LivejournalShareButton-title: Title of the shared page (string)
description: Description of the shared page (string)
MailruShareButton-title: Title of the shared page (string)
description: Description of the shared page (string)
image: An absolute link to the image that will be shared (string)
ViberShareButton-title: Title of the shared page (string)
separator: Separates title from the url, default: " " (string)
WorkplaceShareButton-quote: A quote to be shared along with the link. (string)
hashtag: A hashtag specified by the developer to be added to the shared content. People will still have the opportunity to remove this hashtag in the dialog. The hashtag should include the hash symbol. (string)
LineShareButton-title: Title of the shared page (string)
WeiboShareButton-title: Title of the shared page (string)
image: An absolute link to the image that will be shared (string)
EmailShareButton-subject: Title of the shared page (string)
body: Body of the email (string), will be prepended to the url.
separator: Separates body from the url, default: " " (string)
openWindow: Opens the mail client in a new window. Defaults to false (bool)
PocketShareButton-title: Title of the shared page (string). Note that if Pocket detects a title tag on the page being saved, this parameter will be ignored and the title tag of the saved page will be used instead.
InstapaperShareButton-title: Title of the shared page (string)
description: Description of the shared page (string)
FacebookMessengerShareButtonappId: Facebook application id (string)redirectUri: The URL (string) to redirect to after a person clicks a button on the dialog, default to shared url.
display: Determines how the dialog is rendered (string).
to: A user ID (string) of a recipient. Once the dialog comes up, the sender can specify additional people as recipients.

Share counts

import {
  FacebookShareCount,
  PinterestShareCount,
  VKShareCount,
  OKShareCount,
  RedditShareCount,
  TumblrShareCount,
} from 'react-share';

All share count components take in only one mandatory prop: url, which is the URL you are sharing. className prop is optional.

Example:

<FacebookShareCount url={shareUrl} />

If you want to render anything else but the count, you can provide a function as a child element that takes in shareCount as an argument and returns an element:

<FacebookShareCount url={shareUrl}>
  {shareCount => (
    <span className="myShareCountWrapper">{shareCount}</span>
  )}
</FacebookShareCount>

Icons

import {
  FacebookIcon,
  TwitterIcon,
  TelegramIcon,
  WhatsappIcon,
  LinkedinIcon,
  PinterestIcon,
  VKIcon,
  OKIcon,
  RedditIcon,
  TumblrIcon,
  LivejournalIcon,
  MailruIcon,
  ViberIcon,
  WorkplaceIcon,
  LineIcon,
  PocketIcon,
  InstapaperIcon,
  EmailIcon,
  FacebookMessengerIcon,
} from 'react-share';

Props:

  • size: Icon size in pixels (number)

  • round: Whether to show round or rect icons (bool)

  • borderRadius: Allow rounded corners if using rect icons (number)

  • iconBgStyle: customize background style, e.g. fill (object)

  • logoFillColor: customize logo's fill color (string, default = 'white')

Example:

<TwitterIcon size={32} round={true} />

About semantic versioning

This library uses the standard semver convention. However, the share buttons and and counts are prone to lots of changes that are not in control of this library. For example: if Facebook decides to change or deprecate it's API in a major way, this library will not get a major version bump just because of that. Keep this in mind when you are planning the maintenance of your application.

License

MIT

Icons

Icon paths provided by: react-social-icons.

Keywords

FAQs

Package last updated on 21 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc