Temporary fork of react-share
npm install react-share-stc

> Social media share buttons and share counts for React.

Migrating from v1 to v2? Read migration notes.
* no external script loading, i.e. no dependencies on SDKs
* opens a popup share-window
* share buttons for:
- Facebook
- Twitter
- Telegram
- Google+
- Whatsapp
- LinkedIn
- Pinterest
- VK
- Odnoklassniki
- Reddit
- Tumblr
- Mail.Ru
- LiveJournal
- Viber
- email
* share counts for
- Facebook
- Google+
- Linkedin
- Pinterest
- VK
- Odnoklassniki
- Reddit
- Tumblr
* social media icons included in the library
* supports also custom icons
#### Demo
To run demo: clone repo and run npm install && npm run run-demos
and open http://localhost:8080.
``shell`
npm install react-share --save
ShareButtons work on all browsers.
ShareCounts works on all browsers, with the exception of Google Plus share count
working only on IE11 and newer (XHR CORS problem).
__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.
`js`
import {
FacebookShareButton,
GooglePlusShareButton,
LinkedinShareButton,
TwitterShareButton,
TelegramShareButton,
WhatsappShareButton,
PinterestShareButton,
VKShareButton,
OKShareButton,
RedditShareButton,
TumblrShareButton,
LivejournalShareButton,
MailruShareButton,
ViberShareButton,
EmailShareButton,
} from 'react-share';
##### Share button props
| |Required props|Optional props|
|-------|--------|--------------|
|__All__|__children__: 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.|quote
|FacebookShareButton|-|____: 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)|title
|GooglePlusShareButton|-|-|
|LinkedinShareButton|-|____: Title of the shared page (string)description
____: Description of the shared page (string)|title
|TwitterShareButton|-|____: Title of the shared page (string)via
____: (string)hashtags
____: (array)|title
|TelegramShareButton|-|____: Title of the shared page (string)title
|
|WhatsappShareButton|-|____: Title of the shared page (string)separator
____: Separates title from the url, default: " " (string)|media
|PinterestShareButton|____: An absolute link to the image that will be pinned (string)|__description__: Description for the shared media.|title
|VKShareButton|-|____: 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)|title
|OKShareButton|-|____: 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)|title
|RedditShareButton|-|____: Title of the shared page (string)|title
|TumblrShareButton|-|____: Title of the shared page (string)tags
____: (array)caption
____: Description of the shared page (string)|title
|LivejournalShareButton|-|____: Title of the shared page (string)description
____: Description of the shared page (string)|title
|MailruShareButton|-|____: 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)|title
|ViberShareButton|-|____: Title of the shared page (string)subject
|
|EmailShareButton|-|____: Title of the shared page (string)body
____: Body of the email (string), defaults to shared url.|
`js`
import {
FacebookShareCount,
GooglePlusShareCount,
LinkedinShareCount,
PinterestShareCount,
VKShareCount,
OKShareCount,
RedditShareCount,
TumblrShareCount,
} from 'react-share';
All share count components take in only one mandatory prop: url, which is theclassName
URL you are sharing. prop is optional.
Example:
`jsx`
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:
`jsx`
{shareCount => (
{shareCount}
)}
`js`
import {
FacebookIcon,
TwitterIcon,
TelegramIcon,
WhatsappIcon,
GooglePlusIcon,
LinkedinIcon,
PinterestIcon,
VKIcon,
OKIcon,
RedditIcon,
TumblrIcon,
LivejournalIcon,
MailruIcon,
EmailIcon,
ViberIcon,
} from 'react-share';
Props:
* size: Icon size in pixels (number)
* round: Whether to show round or rect icons (bool)
* iconBgStyle: customize background style, e.g. fill (object)
* logoFillColor: customize logo's fill color (string, default = 'white')
Example:
```
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.
MIT
Icon paths provided by:
react-social-icons.