• Stars
    star
    177
  • Rank 215,985 (Top 5 %)
  • Language
    HTML
  • Created almost 10 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Simple React components for social buttons (Facebook, Twitter and Pinterest) and social counts.

react-social

NPM version Build Status Dependency Status Download Count

Simple React components for social (Facebook, Google, VKontakte, Pinterest ...) buttons and counts.

Install

npm install react-social --save

Example

import { FacebookButton, FacebookCount } from "react-social";

class App extends Component {
  render {
    let url = "https://github.com";

    return (
      <FacebookButton url={url} appId={appId}>
        <FacebookCount url={url} />
        {" Share " + url}
      </FacebookButton>
    );
  }
}

Count API

WARNING: GooglePlusCount, TwitterCount and PocketCount uses the donreach API which has a limit of 1000 request per day, if you have an alternative please do not hesitate to make a PR

  • FacebookCount
  • TwitterCount
  • GooglePlusCount
  • PinterestCount
  • LinkedInCount
  • RedditCount
  • VKontakteCount
  • TumblrCount
  • PocketCount

Props

element

Change the element the component renders into, default is span.

url

The url you want to get the count of, default is window.location.

token
  • FacebookButton

Optional access token.

onCount

Callback for when the count is updated. Callback takes one argument count.

Methods

getCount()

Return the social count.

Button API

  • FacebookButton
  • TwitterButton
  • GooglePlusButton
  • PinterestButton
  • LinkedInButton
  • RedditButton
  • VKontakteButton
  • EmailButton
  • XingButton
  • TumblrButton
  • PocketButton
  • OdnoklassnikiButton
  • MyMailRuButton

Props

element

Change the element the component renders into, default is button.

url

The url you want to share, default is window.location.

target

The target you want to open, default is _blank.

windowOptions

Pass options to window.open.

message
  • TwitterButton
  • FacebookButton
  • XingButton
  • TumblrButton
  • PocketButton
  • VKButton
  • PinterestButton (required)
  • OdnoklassnikiButton (required)
  • MyMailRuButton (required)

A message that's prepended before the url.

title
  • VKButton
  • RedditButton
  • LinkedInButton
  • OdnoklassnikiButton (required)
  • MyMailRuButton (required)

Title of your shared content.

media
  • PinterestButton (required)
  • FacebookButton (optional)
  • OdnoklassnikiButton (required)
  • MyMailRuButton (required)

Url of an image.

appId
  • FacebookButton (required)

Facebook app id.

sharer
  • FacebookButton

Facebook has 2 different share dialogs. By default we're showing Feed Dialog which has more options, but supports only sharing to user's feed. You can set sharer option to true and we'll show Share Dialog where user can choose between their feed and also pages they have access to.

Styles

There are no styles included, the components pass all their props down to their element like className and style so you can easily style them yourself.

Notice

  • When rendered server side counts will be 0 since they depend on JSONP.
  • GooglePlusCount, TwitterCount and PocketCount uses the donreach API which has a limit of 1000 requests per day.

Contributors

  • Ola Holmstrรถm (@olahol)
  • Alexandr Sugak (@AlexSugak)
  • Jon Principe (@jprincipe)
  • Jean-Baptiste Quenot (@jbq)
  • Kurt Weiberth (@kweiberth)
  • Bartek Gruszka (@bartekgruszka)
  • Josh Owens (@queso)
  • Maxime Mezrahi (@maxs15)
  • Arvin Tehrani (@arvinkx)
  • Dennis Stรผcken (@dstuecken)
  • Jonas (@jonashaefele)
  • River Kanies (@riverKanies)
  • Pavel Linkesch (@orthes)
  • Vincent (@vkammerer)
  • Alexey Balmasov (@balmasich)
  • Amitom (@Amitom)
  • Ryan Nevius (@rnevius)
  • David Lakata (@dlakata)
  • Roman Kosovichev (@roma-so)
  • Igor Pnev (@exdeniz)
  • Belevskij Sergeij (@r72cccp)

MIT Licensed

More Repositories

1

melody

๐ŸŽถ Minimalist websocket framework for Go
Go
3,685
star
2

react-tagsinput

Highly customizable React component for inputing tags.
JavaScript
1,345
star
3

reactpack

๐Ÿ“ฆ build your react apps with one command and one `npm i`.
JavaScript
982
star
4

melody-jsnes

๐Ÿ“บ Multiplayer NES through the magic of WebSockets and Go.
HTML
767
star
5

react-ab

Simple declarative and universal A/B testing component for React.
JavaScript
432
star
6

go-imageupload

๐Ÿ”ณ Gracefully handle image uploading and thumbnail creation.
Go
139
star
7

iso-3166-2.js

Lookup information about ISO-3166-2 subdivisions
JavaScript
108
star
8

express-chrome-logger

Debug your express app using the Chrome console.
JavaScript
83
star
9

pocketplace

๐ŸŽ† Draw pixels on a canvas with friends.
Go
79
star
10

scrollparent.js

A function to get the scrolling parent of a html element.
HTML
58
star
11

node-csp

Communicating sequential processes for node.
JavaScript
55
star
12

iso-3166-2.json

JSON file of ISO 3166-2 subdivisions.
JavaScript
54
star
13

greasyphone

๐Ÿ“ฑ ๐ŸŽฎ Play NES using smartphones as joypads
JavaScript
45
star
14

viewdiff

๐Ÿ“’ view your diffs in a separate window.
JavaScript
41
star
15

bf2c

๐Ÿ› Not the smallest compiler ever
JavaScript
20
star
16

socialcount.js

Tiny javascript library for getting social share counts. Pinterest, Facebook, Twitter and Google Plus supported.
JavaScript
17
star
17

cpp-csp

Minimalistic header-only library for channels and CSP (Communicating sequential process) in C++11.
C++
15
star
18

ethereum-web1-guestbook

๐Ÿ““ A Web 1.0 guestbook on Web 3.0
HTML
15
star
19

mainthread

Run functions in Go's main thread.
Go
14
star
20

eselement

DOM-like wrapper around the Javascript AST
JavaScript
6
star
21

tsreflect

Flexible reflection based TypeScript type generator for Go types that can be marshalled with `encoding/json`.
Go
6
star
22

capreq

Capture HTTP Requests using gopacket and libpcap
Go
6
star
23

hnplain

output Hacker News in plain text
Python
6
star
24

react-bus

Event emitter designed for communication between react components.
JavaScript
5
star
25

bf2asmjs

A simple brainfuck compiler targeting asm.js
Python
5
star
26

spawn.js

Tiny javascript library for spinning up one off web workers.
JavaScript
3
star
27

node-crcaptcha

Node package for using the Civil Rights Captcha.
JavaScript
2
star
28

tiny-xss-scanner

Lighweight xss scanner
Python
2
star
29

olapass

Stateless password manager.
JavaScript
1
star
30

request-animation-loop

As setInterval is to setTimeout, requestAnimationLoop is to requestAnimationFrame.
JavaScript
1
star
31

cpp-project-template

A small template for C++11 projects using tup and clang.
C++
1
star
32

generator-react-umd

A Yeoman generator that generates a minimalistic scaffold for a ES6 React component wrapped with the UMD.
JavaScript
1
star
33

gin-csrf

CSRF protection middleware for Go web framework Gin
Go
1
star
34

deepmodules

Analyze depth of Go packages
Go
1
star
35

node-mysql-slowlog

Application level slow log for mysql connections. Good for debugging slow queries when you haven't turned on or have access to the database slow log.
JavaScript
1
star