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.


Table of Contents
Installation
To install React-Share-Kit, simply run:
npm install react-share-kit
or
yarn add react-share-kit
π₯ Share Buttons Detault Props
To use React-Share-Kit in your React application, import the necessary components and pass the relevant props to customize the share buttons. For example:
π¨βπ» Example
import React from 'react';
import { FacebookShare, TwitterShare } from 'react-share-kit';
const ShareButtons = () => {
const shareUrl = 'https://example.com';
const title = 'Check out this awesome website!';
return (
<FacebookShare url={shareUrl} quote={title} />
<TwitterShare url={shareUrl} round title="X" />
);
};
π Default Props
url | string | | The URL of the shared page. | TRUE |
title | string | | The title of the shared page. | FALSE |
windowWidth | number | 550 | Opened window width. | FALSE |
windowHeight | number | 400 | Opened window height. | FALSE |
blankTarget | boolean | false | Open share window in a new tab if set to true . | FALSE |
bgColor | string | related color | Icon background color. | FALSE |
round | boolean | false | The "round" attribute creates a fully circular button shape, giving it a 100% rounded appearance. | FALSE |
borderRadius | number | 0px | Custom round share. | FALSE |
size | number | 64px | The button size. | FALSE |
buttonTitle | string | | The title of button used instead of icon. | FALSE |
π‘ Usage of ShareButtons
Linkedin
π¨βπ» Example
import {
LinkedinShare
} from 'react-share-kit'
<LinkedinShare url={'https://github.com/ayda-tech/react-share-kit'} />
π¨βπ» 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
via | string | | | FALSE |
hashtags | array | | | FALSE |
related | array | | | FALSE |
Facebook
π¨βπ» 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
quote | string | | A quote to be shared. | FALSE |
hashtag | string | | Hashtag to be shared. | FALSE |
FacebookMessenger
π¨βπ» Example
import {
FacebookMessengerShareButton
} from 'react-share-kit'
<FacebookMessengerShareButton
url='https://github.com/ayda-tech/react-share-kit'
redirectUri="https://github.com/ayda-tech/react-share-kit"
appId={'dmm4kj9djk203k4liuf994p'}
/>
π Props
appId | string | | Facebook application id. | TRUE |
redirectUri | string | | The URL to redirect to after sharing (default: the shared url). | FALSE |
to | string | | A user ID of a recipient. Once the dialog comes up, the sender can specify additional people as recipients. | FALSE |
Whatsapp
π¨βπ» 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
Telegram
π¨βπ» Example
import {
TelegramShare
} from 'react-share-kit'
<TelegramShare url={'https://github.com/ayda-tech/react-share-kit'} />
Line
π¨βπ» Example
import {
LineShare
} from 'react-share-kit'
<LineShare url={'https://github.com/ayda-tech/react-share-kit'} />
Pinterest
π¨βπ» 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
media | string | | The image URL that will be pinned. | TRUE |
description | string | | The description of the shared media. | FALSE |
Reddit
π¨βπ» Example
import {
RedditShare
} from 'react-share-kit'
<RedditShare url={'https://github.com/ayda-tech/react-share-kit'} />
Tumblr
π¨βπ» 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
tags | Array<string> | | | FALSE |
caption | string | | The description of the shared page. | FALSE |
posttype | string | link | | FALSE |
Viber
π¨βπ» 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
Weibo
π¨βπ» 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
image | string | | The image URL that will be shared. | FALSE |
VK
π¨βπ» Example
import {
VKShare
} from 'react-share-kit'
<VKShare
url={'https://github.com/ayda-tech/react-share-kit'}
image={'./react-share.png'}
/>
π Props
image | string | | An absolute link to the image that will be shared. | FALSE |
noParse | boolean | | If true is passed, VK will not retrieve URL information. | FALSE |
noVkLinks | boolean | | If true is passed, there will be no links to the user's profile in the open window. Only for mobile devices. | FALSE |
Mailru
π¨βπ» Example
import {
MailruShare
} from 'react-share-kit'
<MailruShare url={'https://github.com/ayda-tech/react-share-kit'} />
π Props
description | string | | Description of the shared page. | FALSE |
imageUrl | string | | Image url of the shared page. | FALSE |
LiveJournal
π¨βπ» Example
import {
LiveJournalShare
} from 'react-share-kit'
<LiveJournalShare url={'https://github.com/ayda-tech/react-share-kit'} />
π Props
description | string | | Description of the shared page. | FALSE |
Workplace
π¨βπ» Example
import {
WorkplaceShare
} from 'react-share-kit'
<WorkplaceShare
url={'https://github.com/ayda-tech/react-share-kit'}
quote={'React Share Kit'}
/>
π Props
quote | string | | | FALSE |
hashtag | string | | | FALSE |
Pocket
π¨βπ» Example
import {
PocketShare
} from 'react-share-kit'
<PocketShare url={'https://github.com/ayda-tech/react-share-kit' />
Instapaper
π¨βπ» Example
import {
InstapaperShare
} from 'react-share-kit'
<InstapaperShare url={'https://github.com/ayda-tech/react-share-kit'} />
π Props
description | string | | Description of the shared page. | FALSE |
Hatena
π¨βπ» Example
import {
HatenaShareButton
} from 'react-share-kit'
<HatenaShare url={'https://github.com/ayda-tech/react-share-kit' />
Gab
π¨βπ» Example
import {
GabShare
} from 'react-share-kit'
<GabShare url={'https://github.com/ayda-tech/react-share-kit'} />
π‘ Usage of ShareCount
Facebook
π¨βπ» 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
url | string | | The URL of the shared page. | TRUE |
appId | string | | Facebook application id. | TRUE |
appSecret | string | | Facebook application secret. | TRUE |
children | node | | React component, HTML element or string. | FALSE |
Hatena
π¨βπ» 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>
π Props
url | string | | The URL of the shared page. | TRUE |
children | node | | React component, HTML element or string. | FALSE |
OK
π¨βπ» 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>
π Props
url | string | | The URL of the shared page. | TRUE |
children | node | | React component, HTML element or string. | FALSE |
Pinterest
π¨βπ» 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>
π Props
url | string | | The URL of the shared page. | TRUE |
children | node | | React component, HTML element or string. | FALSE |
Tumblr
π¨βπ» 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>
π Props</b
url | string | | The URL of the shared page. | TRUE |
children | node | | React component, HTML element or string. | FALSE |
VK
π¨βπ» 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>
π Props
url | string | | The URL of the shared page. | TRUE |
children | node | | React component, HTML element or string. | FALSE |
License
React-Share-Kit is licensed under the MIT License. See the LICENSE file for more details.