Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including ta-react-share-buttons with all npm packages installed. Try it out:

var taReactShareButtons = require("ta-react-share-buttons")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

ta-react-share-buttons v1.0.2

Renders a collection of social sharing buttons.

Modules

ShareButtons/displayTypes

List possible display types

ShareButtons

Renders a collection of social sharing buttons.

ShareButtons/supportedCommunities

List supported communities

Classes

ShareButtons

Members

default

The communities this setup currently supports (i.e. with icons or the shareActionFactory.

Constants

minimumShares : number

Share count number is only being shown if greater than this constant.

Functions

ShareItem()XML

A share item is a single sharing item, consisting of a link with an icon. Using display types, this item can be displayed in different ways, either as a list item or as a button.

ShareButtons/displayTypes

List possible display types

ShareButtons

Renders a collection of social sharing buttons.

Version: 1.0

ShareButtons/supportedCommunities

List supported communities

ShareButtons

Kind: global class

new ShareButtons(props)

Renders social sharing buttons.

ParamTypeDescription
propsObjectSee ShareButtons.propTypes

default

The communities this setup currently supports (i.e. with icons or the shareActionFactory.

Kind: global variable

HORIZONTAL_ICONS : enum

Virtual enums – used to define the different forms a sharing button/icon can take when being shown.

Kind: global enum
Read only: true

minimumShares : number

Share count number is only being shown if greater than this constant.

Kind: global constant

ShareItem() ⇒ XML

A share item is a single sharing item, consisting of a link with an icon. Using display types, this item can be displayed in different ways, either as a list item or as a button.

Kind: global function

ParamTypeDescription
props.displayTypestringEither {@see HORIZONTAL_ICONS} or {@see VERTICAL_BUTTONS}.
props.invertedbooleanIf share items should be shown inverted.
props.typestringCan currently be facebook or twitter.
props.countnumberNumber of shares, if available.
props.descriptionstringDescription – used as activator («Auf Twitter teilen»)
props.shareUrlstringThe action URL that should be opened when clicking the button link.

Renders a collection of social sharing buttons.

Installation

yarn add ta-react-share-buttons

Usage

import ShareButtons, * as shareButtonsSupportLibrary from 'ta-react-share-buttons';

//...

class YourComponent extends React.Component {
  render() {

    return (
      <ShareButtons
          hashtags={['TAGrafik', 'ddj']}
          displayType={shareButtonsSupportLibrary.HORIZONTAL_ICONS}/>
    )
  }
}

Remarks

Display Type

Currently available values:

  • 'horizontal icons'
  • 'vertical buttons'

To simplify working with these values, you can use the enums defined in the module. See Usage for an example of how to do that.

Communities

The default communities are these:

[
  {
    type: 'twitter',
    description: 'Bei Twitter veröffentlichen',
    count: 0
  },
  {
    type: 'facebook',
    description: 'Über Facebook teilen',
    facebook_id: 147124108642216,
    count: 0
  }
]

Community objects need at least a type property to work.

Currently supported community types are

  • twitter
  • facebook

The communities property is modeled after the Newsnet Sharing API, so that the response of that API can easily be dumped into this component.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free