Git Product home page Git Product logo

react-share-button's Introduction

react-share-button

A lightweight React Share Button for mobile web with web share api integration, native intent support and fallback.

Features

  1. Web Share Api (on Origin Trials experiment until April 2017)
  2. Share Modal Fallback for other browsers
  3. Share via Whatsapp, FB, Twitter, Mail or Copy on Clipboard

Installation

npm install --save react-share-button

Basic Usage

To get web-share API on your origin just request a token for your origin. You will get an email within 24 hrs with you key, then just add a meta tag

<meta http-equiv="origin-trial" content="**insert your token as provided in the the email here**">

Know more about OriginTrials

JSX:

import ShareBtn from 'react-share-button';

<ShareBtn
  url={url}
  text={text}
  className='ib'
  displayText='Share'
/>

CSS

@import "react-share-button/dist/ShareBtn"

Options

<ShareBtn/> Component

prop default description
className '' Custom classnamem, you can style your button with this
url '' The URL you want to share
text '' The Text before the URL (E.g. Hey checkout this awesome property!!)
displayText Share Any text you wanna write on button like Share Property
onShareBtnClick () => {} A callback function when share button is clicked
sharedBy (medium) => {console.log('shared via ', medium)} A callback function when user clicks on any share medium from share modal

Development

git clone https://github.com/housinghq/react-share-button
cd react-share-button
npm install
npm run storybook

Open an issue before opening a PR. The UI in this package is for mobile only.

License

MIT @ Loconsolutions

react-share-button's People

Contributors

cgarg avatar dxtr026 avatar mahmoudfelfel avatar ritz078 avatar

Watchers

 avatar  avatar

Forkers

dubizzle

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.