Skip to content

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

Notifications You must be signed in to change notification settings

burtyish/react-social

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-social

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

Install

npm install react-social --save

Example

var FacebookButton = require("./react-social").FacebookButton
  , FacebookCount = require("./react-social").FacebookCount;

var App = React.createClass({
  render: function () {
    var url = "https://github.com";

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

Count (FacebookCount, TwitterCount, PinterestCount) API

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.

Methods

getCount()

Return the social count.

Button (FacebookButton, TwitterButton, PinterestButton) API

Props

element

Change the element the component renders into default is button.

url

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

message

A message that's prepended before the url, works only with FacebookButton and TwitterButton.

media (required for Pinterest)

Url of an image, is required for PinterestButton and only works with PinterestButton.

Styles

The components pass their props down to their element including className and style.


MIT Licensed

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published