1.1.0 ā€¢ Published 5 months ago

react-share-kit v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

React-Share-Kit

React-Share-Kit is a simple and easy-to-use library for adding social media share buttons to your React & Next applications. With React-Share-Kit, you can quickly integrate share buttons for popular social media platforms such as Facebook, Twitter, LinkedIn, and more.

If package size is mater and you don't need use share count functionality instead of your React.js, Next.js and PReact project build with Javascript and Typescript. React-share-lite is the solution to enhance your application performance.


downloads downloads

NPM npm bundle size JavaScript Style Guide

Share buttons screenshot


Table of Contents

Installation

To install React-Share-Kit, simply run:

npm install react-share-kit

or

yarn add react-share-kit

šŸ“• Share Button Global Props

Each button supports a set of global props that are consistent across all buttons. However, in addition to these global props, each button also possesses its own unique set of specific properties. These specific properties are tailored to the individual functionality and customization options of each button.

PropsTypeDefaultDescriptionRequired
urlstringThe URL of the shared page.TRUE
titlestringThe title of the shared page.FALSE
windowWidthnumber550Opened window width.FALSE
windowHeightnumber400Opened window height.FALSE
blankTargetbooleanfalseOpen share window in a new tab if set to true.FALSE
bgColorstringrelated colorIcon background color.FALSE
roundbooleanfalseThe "round" attribute creates a fully circular button shape, giving it a 100% rounded appearance.FALSE
borderRadiusnumber0pxCustom round share.FALSE
sizenumber64pxThe button size.FALSE
buttonTitlestringThe title of button used instead of icon.FALSE

šŸ‘Øā€šŸ’» Example

import React from 'react';
import { FacebookShare, FacebookCount } from 'react-share-kit';

const ShareButtons = () => {
  const shareUrl = 'https://github.com/ayda-tech/react-share-kit';
  const title = 'Check out this awesome website!';

  return (
      <>
        <FacebookShare url={shareUrl} quote={title} />

        <FacebookCount
          url={shareUrl}
          appId='your-app-id'
          appSecret='your-app-secret'
        />

        <FacebookCount
          url={shareUrl}
          appId='your-app-id'
          appSecret='your-app-secret'
        >
          {shareCount => <span className="wrapper">{shareCount}</span>}
        </FacebookCount>
      </>
  );
};

šŸ’” Usage of ShareButtons

Facebook Share

šŸ‘Øā€šŸ’» Example

import { FacebookShare } from 'react-share-kit'

<FacebookShare
  url={'https://github.com/ayda-tech/react-share-kit'}
  quote={'react-share-kit - social share buttons for next & react apps.'}
  hashtag={'#react-share-kit'}
/>

šŸ“• Props: Supports only on Facebook

PropsTypeDefaultDescriptionRequired
quotestringA quote to be shared.FALSE
hashtagstringHashtag to be shared.FALSE

Twitter Share

šŸ‘Øā€šŸ’» Example

import { TwitterShare } from 'react-share-kit'

<TwitterShare
  url={'https://github.com/ayda-tech/react-share-kit'}
  title={'react-share-kit - social share buttons for next & react apps.'}
  hashtags=["#react-share-kit", "#front-end"]
/>

šŸ“• Props: Supports only on Twitter

PropsTypeDefaultDescriptionRequired
viastringFALSE
hashtagsarrayFALSE
relatedarrayFALSE

Linkedin Share

šŸ‘Øā€šŸ’» Example

import { LinkedinShare } from 'react-share-kit'

<LinkedinShare url={'https://github.com/ayda-tech/react-share-kit'} />

Whatsapp Share

šŸ‘Øā€šŸ’» Example

import { WhatsappShare } from 'react-share-kit'

<WhatsappShare
  url={'https://github.com/ayda-tech/react-share-kit'}
  title={'react-share-kit - social share buttons for next & react apps.'}
  separator=":: "
/>

šŸ“• Props: Supports only on WhatsApp

PropsTypeDefaultDescriptionRequired
separatorstringFALSE

Telegram Share

šŸ‘Øā€šŸ’» Example

import { TelegramShare } from 'react-share-kit'

<TelegramShare url={'https://github.com/ayda-tech/react-share-kit'} />

FacebookMessenger Share

šŸ‘Øā€šŸ’» Example

import { FacebookMessengerShare } from 'react-share-kit'

<FacebookMessengerShare
  url='https://github.com/ayda-tech/react-share-kit'
  redirectUri="https://github.com/ayda-tech/react-share-kit"
  appId={'dmm4kj9djk203k4liuf994p'}
/>

šŸ“• Props: Supports only on Facebook Messenger

PropsTypeDefaultDescriptionRequired
appIdstringFacebook application id.TRUE
redirectUristringThe URL to redirect to after sharing (default: the shared url).FALSE
tostringA user ID of a recipient. Once the dialog comes up, the sender can specify additional people as recipients.FALSE

Email Share

šŸ‘Øā€šŸ’» Example

import { EmailShare } from 'next-share'

<EmailShare
  url={'https://github.com/next-share'}
  subject={'Next Share'}
  body="body"
/>

šŸ“• Props: Supports only on Email

PropsTypeDefaultDescriptionRequired
childrennodeReact component, HTML element or string.TRUE
urlstringThe URL of the shared page.TRUE
subjectstringFALSE
bodystringFALSE
separatorstringFALSE
blankTargetbooleanfalseOpen share window in a new tab if set to true.FALSE

VK Share

šŸ‘Øā€šŸ’» Example

import { VKShare } from 'react-share-kit'

<VKShare
  url={'https://github.com/ayda-tech/react-share-kit'}
  image={'./react-share.png'}
/>

šŸ“• Props: Supports only on VK

PropsTypeDefaultDescriptionRequired
imagestringAn absolute link to the image that will be shared.FALSE
noParsebooleanIf true is passed, VK will not retrieve URL information.FALSE
noVkLinksbooleanIf true is passed, there will be no links to the user's profile in the open window. Only for mobile devices.FALSE

Pinterest Share

šŸ‘Øā€šŸ’» Example

import { PinterestShare } from 'react-share-kit'

<PinterestShare
  url={'https://github.com/ayda-tech/react-share-kit'}
  media={'react-share-kit - social share buttons for next & react apps.'}
/>

šŸ“• Props: Supports only on Pinterest

PropsTypeDefaultDescriptionRequired
mediastringThe image URL that will be pinned.TRUE
descriptionstringThe description of the shared media.FALSE

Reddit Share

šŸ‘Øā€šŸ’» Example

import { RedditShare } from 'react-share-kit'

<RedditShare url={'https://github.com/ayda-tech/react-share-kit'} />

Line Share

šŸ‘Øā€šŸ’» Example

import { LineShare } from 'react-share-kit'

<LineShare url={'https://github.com/ayda-tech/react-share-kit'} />

Tumblr Share

šŸ‘Øā€šŸ’» Example

import { TumblrShare } from 'react-share-kit'

<TumblrShare
  url={'https://github.com/ayda-tech/react-share-kit'}
  caption="react-share-kit - social share buttons for next & react apps."
/>

šŸ“• Props: Supports only on Tumblr

PropsTypeDefaultDescriptionRequired
tagsArray<string>FALSE
captionstringThe description of the shared page.FALSE
posttypestringlinkFALSE

Viber Share

šŸ‘Øā€šŸ’» Example

import { ViberShare } from 'react-share-kit'

<ViberShare
  url={'https://github.com/ayda-tech/react-share-kit'}
  title={'react-share-kit - social share buttons for next & react apps.'}
/>

šŸ“• Props: Supports only on Viber

PropsTypeDefaultDescriptionRequired
separatorstringFALSE

Weibo Share

šŸ‘Øā€šŸ’» Example

import { WeiboShare } from 'react-share-kit'

<WeiboShare
  url={'https://github.com/ayda-tech/react-share-kit'}
  title={'react-share-kit - social share buttons for next & react apps.'}
  image={`${String(window.location)}/${example-image}`}
/>

šŸ“• Props: Supports only on Weibo

PropsTypeDefaultDescriptionRequired
imagestringThe image URL that will be shared.FALSE

Mailru Share

šŸ‘Øā€šŸ’» Example

import { MailruShare } from 'react-share-kit'

<MailruShare url={'https://github.com/ayda-tech/react-share-kit'} />

šŸ“• Props: Supports only on Mail-Ru

PropsTypeDefaultDescriptionRequired
descriptionstringDescription of the shared page.FALSE
imageUrlstringImage url of the shared page.FALSE

LiveJournal Share

šŸ‘Øā€šŸ’» Example

import { LiveJournalShare } from 'react-share-kit'

<LiveJournalShare url={'https://github.com/ayda-tech/react-share-kit'} />

šŸ“• Props: Supports only on Live Journal

PropsTypeDefaultDescriptionRequired
descriptionstringDescription of the shared page.FALSE

Workplace Share

šŸ‘Øā€šŸ’» Example

import { WorkplaceShare } from 'react-share-kit'

<WorkplaceShare
  url={'https://github.com/ayda-tech/react-share-kit'}
  quote={'React Share Kit'}
/>

šŸ“• Props: Supports only on Workspace

PropsTypeDefaultDescriptionRequired
quotestringFALSE
hashtagstringFALSE

Pocket Share

šŸ‘Øā€šŸ’» Example

import {
  PocketShare
} from 'react-share-kit'

<PocketShare url='https://github.com/ayda-tech/react-share-kit' />

Instapaper Share

šŸ‘Øā€šŸ’» Example

import { InstapaperShare } from 'react-share-kit'

<InstapaperShare url={'https://github.com/ayda-tech/react-share-kit'} />

šŸ“• Props: Supports only on Instapaper

PropsTypeDefaultDescriptionRequired
descriptionstringDescription of the shared page.FALSE

Hatena Share

šŸ‘Øā€šŸ’» Example

import { HatenaShare } from 'react-share-kit'

<HatenaShare url={'https://github.com/ayda-tech/react-share-kit' />

Gab Share

šŸ‘Øā€šŸ’» Example

import { GabShare } from 'react-share-kit'

<GabShare url={'https://github.com/ayda-tech/react-share-kit'} />

šŸ“• Share Count global props

PropsTypeDefaultDescriptionRequired
urlstringThe URL of the shared page.TRUE
childrennodeReact component, HTML element or string.FALSE
appIdstringFacebook application id.TRUE
appSecretstringFacebook application secret.TRUE

šŸ’” Usage of ShareCount

Facebook Count

šŸ‘Øā€šŸ’» Example

import { FacebookCount } from 'react-share-kit'

<FacebookCount
  url='https://github.com/ayda-tech/react-share-kit'
  appId=''
  appSecret=''
/>

<FacebookCount
  url='https://github.com/ayda-tech/react-share-kit'
  appId=''
  appSecret=''
>
  {shareCount => <span className="wrapper">{shareCount}</span>}
</FacebookCount>

šŸ“• Props: Supports only on Facebook count

PropsTypeDefaultDescriptionRequired
appIdstringFacebook application id.TRUE
appSecretstringFacebook application secret.TRUE

Hatena Count

šŸ‘Øā€šŸ’» Example

import { HatenaCount } from 'react-share-kit'

<HatenaCount url={'https://github.com/ayda-tech/react-share-kit'} />

<HatenaCount url={'https://github.com/ayda-tech/react-share-kit'}>
  {shareCount => <span className="wrapper">{shareCount}</span>}
</HatenaCount>

OK Count

šŸ‘Øā€šŸ’» Example

import { OKCount } from 'react-share-kit'

<OKCount url={'https://github.com/ayda-tech/react-share-kit'} />

<OKCount url={'https://github.com/ayda-tech/react-share-kit'}>
  {shareCount => <span className="wrapper">{shareCount}</span>}
</OKCount>

Pinterest Count

šŸ‘Øā€šŸ’» Example

import { PinterestShareCount } from 'react-share-kit'

<PinterestCount url={'https://github.com/ayda-tech/react-share-kit'} />

<PinterestCount url={'https://github.com/ayda-tech/react-share-kit'}>
  {shareCount => <span className="wrapper">{shareCount}</span>}
</PinterestCount>

Tumblr Count

šŸ‘Øā€šŸ’» Example

import { TumblrCount } from 'react-share-kit'

<TumblrCount url={'https://github.com/ayda-tech/react-share-kit'} />

<TumblrCount url={'https://github.com/ayda-tech/react-share-kit'}>
  {shareCount => <span className="wrapper">{shareCount}</span>}
</TumblrCount>

VK Count

šŸ‘Øā€šŸ’» Example

import { VKCount } from 'react-share-kit'

<VKSCount url={'https://github.com/ayda-tech/react-share-kit'} />

<VKCount url={'https://github.com/ayda-tech/react-share-kit'}>
  {shareCount => <span className="wrapper">{shareCount}</span>}
</VKCount>

License

React-Share-Kit is licensed under the MIT License. See the LICENSE file for more details.

1.1.0

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago

0.1.14

5 months ago

0.1.13

6 months ago

0.1.12

6 months ago

0.1.11

6 months ago

0.1.10

6 months ago

0.1.9

6 months ago

0.1.8

6 months ago

0.1.7

6 months ago

0.1.6

6 months ago

0.1.5

6 months ago

0.1.4

6 months ago

0.1.3

6 months ago

0.1.2

6 months ago

0.1.1

6 months ago

0.1.0

6 months ago

0.0.1

6 months ago