Skip to content

Latest commit

 

History

History
79 lines (48 loc) · 1.44 KB

README.md

File metadata and controls

79 lines (48 loc) · 1.44 KB

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