Giter VIP home page Giter VIP logo

react-sharingbuttons's Introduction

react-sharingbuttons

Lightweight social sharing buttons for React. No tracking. Just fun. Heavily inspired by sharingbuttons.io

Demo & Docs:

https://caspg.github.io/react-sharingbuttons

Installation

  yarn add react-sharingbuttons

or alternatively:

npm install --save react-sharingbuttons

Usage

import { Facebook, Twitter } from 'react-sharingbuttons'

NOTE If you care about your bundle size, you can import each button separately.

import Facebook from 'react-sharingbuttons/dist/buttons/Facebook'
import Twitter from 'react-sharingbuttons/dist/buttons/Twitter'

Import predefined css:

import 'react-sharingbuttons/dist/main.css'
const sharingButtons = () => {
  const url = 'https://github.com/caspg/react-sharingbuttons'
  const shareText = 'Check this site!'

  return (
    <div>
      <Facebook url={url} />
      <Twitter url={url} shareText={shareText} />
    </div>
  )
}

See the example

Overriding styles

You can customize buttons further to meet your needs. For example, following html will be rendered for Twitter button:

<a href="https://your.website" class="react-sharing-button__link react-sharing-button--twitter">
  <svg class="react-sharing-button__icon">...</svg>
  <span class="react-sharing-button__text">Share me</span>
</a>

Available buttons and its props

common props:

  • text - text which is displayed inside button, default to button name.
  • onClick - onClick event passed to a tag.

button specific props:

Email text, url, subject
Facebook text, url
Google text, url
Pinterest text, url, shareText (a pin description), mediaSrc
Reddit text, url
Twitter text, url, shareText (a tweet text),
Tumblr text, url, title, caption, content

react-sharingbuttons's People

Contributors

caspg avatar ebrou avatar rvntone avatar webdevian avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.