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
π‘ Usage of ShareButtons
Facebook
π¨βπ» Code
import {
FacebookShareButton
} from 'react-share-kit'
<FacebookShareButton
url={'https://github.com/ayda-tech/react-share-kit'}
quote={'react-share-kit is a social share buttons for your next React apps.'}
hashtag={'#ReachShareKit'}
round
/>
π Props
children | node | | React component, HTML element or string. | β
|
url | string | | The URL of the shared page. | β
|
quote | string | | A quote to be shared. | β |
hashtag | string | | Hashtag to be shared. | β |
windowWidth | number | 550 | Opened window width. | β |
windowHeight | number | 400 | Opened window height. | β |
blankTarget | boolean | false | Open share window in a new tab if set to true . | β |
bgColor | string | related color | It used for button background color. | β |
round | boolean | false | Open share window in a new tab if set to true . | β |
size | number | 64px | The button size. | β |
buttonTitle | string | | The title of button used instead of icon. | β |
Line
π¨βπ» Code
import {
LineShareButton
} from 'next-share-kit'
<LineShareButton
url={'https://github.com/ayda-tech/react-share-kit'}
title={'next-share-kit is a social share buttons for your next React apps.'}
/>
π Props
children | node | | React component, HTML element or string. | β
|
url | string | | The URL of the shared page. | β
|
title | string | | The title of the shared page. | β |
windowWidth | number | 500 | Opened window width. | β |
windowHeight | number | 500 | Opened window height. | β |
blankTarget | boolean | false | Open share window in a new tab if set to true . | β |
bgColor | string | related color | It used for button background color. | β |
round | boolean | false | Open share window in a new tab if set to true . | β |
size | number | 64px | The button size. | β |
buttonTitle | string | | The title of button used instead of icon. | β |
Pinterest
π¨βπ» Code
import {
PinterestShareButton
} from 'next-share-kit'
<PinterestShareButton
url={'https://github.com/ayda-tech/react-share-kit'}
media={'next-share-kit is a social share buttons for your next React apps.'}
/>
π Props
children | node | | React component, HTML element or string. | β
|
url | string | | The URL of the shared page. | β
|
media | string | | The image URL that will be pinned. | β
|
description | string | | The description of the shared media. | β |
windowWidth | number | 1000 | Opened window width. | β |
windowHeight | number | 730 | Opened window height. | β |
blankTarget | boolean | false | Open share window in a new tab if set to true . | β |
bgColor | string | related color | It used for button background color. | β |
round | boolean | false | Open share window in a new tab if set to true . | β |
size | number | 64px | The button size. | β |
buttonTitle | string | 64px | The title of button used instead of icon. | β |
bgColor | string | related color | It used for button background color. | β |
round | boolean | false | Open share window in a new tab if set to true . | β |
size | number | 64px | The button size. | β |
buttonTitle | string | | The title of button used instead of icon. | β |
Reddit
π¨βπ» Code
import {
RedditShareButton
} from 'next-share-kit'
<RedditShareButton
url={'https://github.com/ayda-tech/react-share-kit'}
title={'next-share-kit is a social share buttons for your next React apps.'}
/>
π Props
children | node | | React component, HTML element or string. | β
|
url | string | | The URL of the shared page. | β
|
title | string | | The title of the shared page. | β |
windowWidth | number | 660 | Opened window width. | β |
windowHeight | number | 460 | Opened window height. | β |
blankTarget | boolean | false | Open share window in a new tab if set to true . | β |
bgColor | string | related color | It used for button background color. | β |
round | boolean | false | Open share window in a new tab if set to true . | β |
size | number | 64px | The button size. | β |
buttonTitle | string | | The title of button used instead of icon. | β |
Telegram
π¨βπ» Code
import {
TelegramShareButton
} from 'next-share-kit'
<TelegramShareButton
url={'https://github.com/ayda-tech/react-share-kit'}
title={'next-share-kit is a social share buttons for your next React apps.'}
/>
π Props
children | node | | React component, HTML element or string. | β
|
url | string | | The URL of the shared page. | β
|
title | string | | The title of the shared page. | β |
windowWidth | number | 550 | Opened window width. | β |
windowHeight | number | 400 | Opened window height. | β |
blankTarget | boolean | false | Open share window in a new tab if set to true . | β |
bgColor | string | related color | It used for button background color. | β |
round | boolean | false | Open share window in a new tab if set to true . | β |
size | number | 64px | The button size. | β |
buttonTitle | string | | The title of button used instead of icon. | β |
Tumblr
π¨βπ» Code
import {
TumblrShareButton
} from 'next-share-kit'
<TumblrShareButton
url={'https://github.com/ayda-tech/react-share-kit'}
title={'next-share-kit is a social share buttons for your next React apps.'}
/>
π Props
children | node | | React component, HTML element or string. | β
|
url | string | | The URL of the shared page. | β
|
title | string | | The title of the shared page. | β |
tags | Array<string> | | | β |
caption | string | | The description of the shared page. | β |
posttype | string | link | | β |
windowWidth | number | 660 | Opened window width. | β |
windowHeight | number | 460 | Opened window height. | β |
blankTarget | boolean | false | Open share window in a new tab if set to true . | β |
bgColor | string | related color | It used for button background color. | β |
round | boolean | false | Open share window in a new tab if set to true . | β |
size | number | 64px | The button size. | β |
buttonTitle | string | | The title of button used instead of icon. | β |
π¨βπ» Code
import {
TwitterShareButton
} from 'next-share-kit'
<TwitterShareButton
url={'https://github.com/ayda-tech/react-share-kit'}
title={'next-share-kit is a social share buttons for your next React apps.'}
/>
π Props
children | node | | React component, HTML element or string. | β
|
url | string | | The URL of the shared page. | β
|
title | string | | The title of the shared page. | β |
via | string | | | β |
hashtags | array | | | β |
related | array | | | β |
windowWidth | number | 550 | Opened window width. | β |
windowHeight | number | 400 | Opened window height. | β |
blankTarget | boolean | false | Open share window in a new tab if set to true . | β |
bgColor | string | related color | It used for button background color. | β |
round | boolean | false | Open share window in a new tab if set to true . | β |
size | number | 64px | The button size. | β |
buttonTitle | string | | The title of button used instead of icon. | β |
Viber
π¨βπ» Code
import {
ViberShareButton
} from 'next-share-kit'
<ViberShareButton
url={'https://github.com/ayda-tech/react-share-kit'}
title={'next-share-kit is a social share buttons for your next React apps.'}
/>
π Props
children | node | | React component, HTML element or string. | β
|
url | string | | The URL of the shared page. | β
|
title | string | | The title of the shared page. | β |
separator | | | | β |
windowWidth | number | 660 | Opened window width. | β |
windowHeight | number | 460 | Opened window height. | β |
blankTarget | boolean | false | Open share window in a new tab if set to true . | β |
bgColor | string | related color | It used for button background color. | β |
round | boolean | false | Open share window in a new tab if set to true . | β |
size | number | 64px | The button size. | β |
buttonTitle | string | | The title of button used instead of icon. | β |
Weibo
π¨βπ» Code
import {
WeiboShareButton
} from 'next-share-kit'
<WeiboShareButton
url={'https://github.com/ayda-tech/react-share-kit'}
title={'next-share-kit is a social share buttons for your next React apps.'}
image={`${String(window.location)}/${example-image}`}
/>
π Props
children | node | | React component, HTML element or string. | β
|
url | string | | The URL of the shared page. | β
|
title | string | | The title of the shared page. | β |
image | string | | The image URL that will be shared. | β |
windowWidth | number | 660 | Opened window width. | β |
windowHeight | number | 550 | Opened window height. | β |
blankTarget | boolean | false | Open share window in a new tab if set to true . | β |
bgColor | string | related color | It used for button background color. | β |
round | boolean | false | Open share window in a new tab if set to true . | β |
size | number | 64px | The button size. | β |
buttonTitle | string | | The title of button used instead of icon. | β |
Whatsapp
π¨βπ» Code
import {
WhatsappShareButton
} from 'next-share-kit'
<WhatsappShareButton
url={'https://github.com/ayda-tech/react-share-kit'}
title={'next-share-kit is a social share buttons for your next React apps.'}
separator=":: "
/>
π Props
children | node | | React component, HTML element or string. | β
|
url | string | | The URL of the shared page. | β
|
title | string | | The title of the shared page. | β |
separator | string | | | β |
windowWidth | number | 550 | Opened window width. | β |
windowHeight | number | 400 | Opened window height. | β |
blankTarget | boolean | false | Open share window in a new tab if set to true . | β |
bgColor | string | related color | It used for button background color. | β |
round | boolean | false | Open share window in a new tab if set to true . | β |
size | number | 64px | The button size. | β |
buttonTitle | string | | The title of button used instead of icon. | β |
Linkedin
π¨βπ» Code
import {
LinkedinShareButton
} from 'next-share-kit'
<LinkedinShareButton url={'https://github.com/ayda-tech/react-share-kit'} />
π Props
children | node | | React component, HTML element or string. | β
|
url | string | | The URL of the shared page. | β
|
windowWidth | number | 750 | Opened window width. | β |
windowHeight | number | 600 | Opened window height. | β |
blankTarget | boolean | false | Open share window in a new tab if set to true . | β |
bgColor | string | related color | It used for button background color. | β |
round | boolean | false | Open share window in a new tab if set to true . | β |
size | number | 64px | The button size. | β |
buttonTitle | string | | The title of button used instead of icon. | β |
VK
π¨βπ» Code
import {
VKShareButton
} from 'next-share-kit'
<VKShareButton
url={'https://github.com/ayda-tech/react-share-kit'}
image={'./next-share.png'}
/>
π Props
children | node | | React component, HTML element or string. | β
|
url | string | | The URL of the shared page. | β
|
title | string | | The title of the shared page. | β |
image | string | | An absolute link to the image that will be shared. | β |
noParse | boolean | | If true is passed, VK will not retrieve URL information. | β |
noVkLinks | boolean | | If true is passed, there will be no links to the user's profile in the open window. Only for mobile devices. | β |
windowWidth | number | 660 | Opened window width. | β |
windowHeight | number | 460 | Opened window height. | β |
blankTarget | boolean | false | Open share window in a new tab if set to true . | β |
bgColor | string | related color | It used for button background color. | β |
round | boolean | false | Open share window in a new tab if set to true . | β |
size | number | 64px | The button size. | β |
buttonTitle | string | | The title of button used instead of icon. | β |
Mailru
π¨βπ» Code
import {
MailruShareButton
} from 'next-share-kit'
<MailruShareButton
url={'https://github.com/ayda-tech/react-share-kit'}
title={'Next Share'}
/>
π Props
children | node | | React component, HTML element or string. | β
|
url | string | | The URL of the shared page. | β
|
title | string | | The title of the shared page. | β |
description | string | | Description of the shared page. | β |
imageUrl | string | | Image url of the shared page. | β |
windowWidth | number | 660 | Opened window width. | β |
windowHeight | number | 460 | Opened window height. | β |
blankTarget | boolean | false | Open share window in a new tab if set to true . | β |
bgColor | string | related color | It used for button background color. | β |
round | boolean | false | Open share window in a new tab if set to true . | β |
size | number | 64px | The button size. | β |
buttonTitle | string | | The title of button used instead of icon. | β |
Livejournal
π¨βπ» Code
import {
LivejournalShareButton
} from 'next-share-kit'
<LivejournalShareButton
url={'https://github.com/ayda-tech/react-share-kit'}
title={'Next Share'}
description={'https://github.com/ayda-tech/react-share-kit'}
/>
π Props
children | node | | React component, HTML element or string. | β
|
url | string | | The URL of the shared page. | β
|
title | string | | The title of the shared page. | β |
description | string | | Description of the shared page. | β |
windowWidth | number | 660 | Opened window width. | β |
windowHeight | number | 460 | Opened window height. | β |
blankTarget | boolean | false | Open share window in a new tab if set to true . | β |
bgColor | string | related color | It used for button background color. | β |
round | boolean | false | Open share window in a new tab if set to true . | β |
size | number | 64px | The button size. | β |
buttonTitle | string | | The title of button used instead of icon. | β |
Workplace
π¨βπ» Code
import {
WorkplaceShareButton
} from 'next-share-kit'
<WorkplaceShareButton
url={'https://github.com/ayda-tech/react-share-kit'}
quote={'Next Share'}
/>
π Props
children | node | | React component, HTML element or string. | β
|
url | string | | The URL of the shared page. | β
|
quote | string | | | β |
hashtag | string | | | β |
windowWidth | number | 550 | Opened window width. | β |
windowHeight | number | 400 | Opened window height. | β |
blankTarget | boolean | false | Open share window in a new tab if set to true . | β |
bgColor | string | related color | It used for button background color. | β |
round | boolean | false | Open share window in a new tab if set to true . | β |
size | number | 64px | The button size. | β |
buttonTitle | string | | The title of button used instead of icon. | β |
Pocket
π¨βπ» Code
import {
PocketShareButton
} from 'next-share-kit'
<PocketShareButton
url={'https://github.com/ayda-tech/react-share-kit'}
title={'Next Share'}
/>
π Props
children | node | | React component, HTML element or string. | β
|
url | string | | The URL of the shared page. | β
|
title | string | | Title of the shared page. Note that if Pocket detects a title tag on the page being saved, this parameter will be ignored and the title tag of the saved page will be used instead. | β |
windowWidth | number | 500 | Opened window width. | β |
windowHeight | number | 500 | Opened window height. | β |
blankTarget | boolean | false | Open share window in a new tab if set to true . | β |
bgColor | string | related color | It used for button background color. | β |
round | boolean | false | Open share window in a new tab if set to true . | β |
size | number | 64px | The button size. | β |
buttonTitle | string | | The title of button used instead of icon. | β |
Instapaper
π¨βπ» Code
import {
InstapaperShareButton
} from 'next-share-kit'
<InstapaperShareButton
url={'https://github.com/ayda-tech/react-share-kit'}
title={'Next Share'}
/>
π Props
children | node | | React component, HTML element or string. | β
|
url | string | | The URL of the shared page. | β
|
title | string | | Title of the shared page. | β |
description | string | | Description of the shared page. | β |
windowWidth | number | 500 | Opened window width. | β |
windowHeight | number | 500 | Opened window height. | β |
blankTarget | boolean | false | Open share window in a new tab if set to true . | β |
bgColor | string | related color | It used for button background color. | β |
round | boolean | false | Open share window in a new tab if set to true . | β |
size | number | 64px | The button size. | β |
buttonTitle | string | | The title of button used instead of icon. | β |
Hatena
π¨βπ» Code
import {
HatenaShareButton
} from 'next-share-kit'
<HatenaShareButton
url={'https://github.com/ayda-tech/react-share-kit'}
title={'Next Share'}
/>
π Props
children | node | | React component, HTML element or string. | β
|
url | string | | The URL of the shared page. | β
|
title | string | | Title of the shared page. | β |
windowWidth | number | 660 | Opened window width. | β |
windowHeight | number | 460 | Opened window height. | β |
blankTarget | boolean | false | Open share window in a new tab if set to true . | β |
bgColor | string | related color | It used for button background color. | β |
round | boolean | false | Open share window in a new tab if set to true . | β |
size | number | 64px | The button size. | β |
buttonTitle | string | | The title of button used instead of icon. | β |
FacebookMessenger
π¨βπ» Code
import {
FacebookMessengerShareButton
} from 'next-share-kit'
<FacebookMessengerShareButton
url={'https://github.com/ayda-tech/react-share-kit'}
appId={''}
/>
π Props
children | node | | React component, HTML element or string. | β
|
url | string | | The URL of the shared page. | β
|
appId | string | | Facebook application id. | β
|
redirectUri | string | | The URL to redirect to after sharing (default: the shared url). | β |
to | string | | A user ID of a recipient. Once the dialog comes up, the sender can specify additional people as recipients. | β |
windowWidth | number | 1000 | Opened window width. | β |
windowHeight | number | 820 | Opened window height. | β |
blankTarget | boolean | false | Open share window in a new tab if set to true . | β |
bgColor | string | related color | It used for button background color. | β |
round | boolean | false | Open share window in a new tab if set to true . | β |
size | number | 64px | The button size. | β |
buttonTitle | string | | The title of button used instead of icon. | β |
Email
π¨βπ» Code
import {
EmailShareButton
} from 'next-share-kit'
<EmailShareButton
url={'https://github.com/ayda-tech/react-share-kit'}
subject={'Next Share'}
body="body"
/>
π Props
children | node | | React component, HTML element or string. | β
|
url | string | | The URL of the shared page. | β
|
subject | string | | | β |
body | string | | | β |
separator | string | | | β |
blankTarget | boolean | false | Open share window in a new tab if set to true . | β |
bgColor | string | related color | It used for button background color. | β |
round | boolean | false | Open share window in a new tab if set to true . | β |
size | number | 64px | The button size. | β |
buttonTitle | string | | The title of button used instead of icon. | β |
Gab
π¨βπ» Code
import {
GabShareButton,
} from 'next-share-kit'
<GabShareButton
url={'https://github.com/ayda-tech/react-share-kit'}
title={'Next Share'}
/>
π Props
children | node | | React component, HTML element or string. | β
|
url | string | | The URL of the shared page. | β
|
title | string | | Title of the shared page. | β |
windowWidth | number | 660 | Opened window width. | β |
windowHeight | number | 640 | Opened window height. | β |
bgColor | string | related color | It used for button background color. | β |
round | boolean | false | Open share window in a new tab if set to true . | β |
size | number | 64px | The button size. | β |
buttonTitle | string | | The title of button used instead of icon. | β |
π‘ Usage of ShareCount
Facebook
π¨βπ» Code
import { FacebookShareCount } from 'next-share-kit'
<FacebookShareCount
url='https://github.com/ayda-tech/react-share-kit'
appId=''
appSecret=''
/>
<FacebookShareCount
url='https://github.com/ayda-tech/react-share-kit'
appId=''
appSecret=''
>
{shareCount => <span className="wrapper">{shareCount}</span>}
</FacebookShareCount>
π Props
url | string | | The URL of the shared page. | β
|
appId | string | | Facebook application id. | β
|
appSecret | string | | Facebook application secret. | β
|
children | node | | React component, HTML element or string. | β |
Hatena
π¨βπ» Code
import { HatenaShareCount } from 'next-share-kit'
<HatenaShareCount url={'https://github.com/ayda-tech/react-share-kit'} />
<HatenaShareCount url={'https://github.com/ayda-tech/react-share-kit'}>
{shareCount => <span className="wrapper">{shareCount}</span>}
</HatenaShareCount>
π Props
url | string | | The URL of the shared page. | β
|
children | node | | React component, HTML element or string. | β |
OK
π¨βπ» Code
import { OKShareCount } from 'next-share-kit'
<OKShareCount url={'https://github.com/ayda-tech/react-share-kit'} />
<OKShareCount url={'https://github.com/ayda-tech/react-share-kit'}>
{shareCount => <span className="wrapper">{shareCount}</span>}
</OKShareCount>
π Props
url | string | | The URL of the shared page. | β
|
children | node | | React component, HTML element or string. | β |
Pinterest
π¨βπ» Code
import { PinterestShareCount } from 'next-share-kit'
<PinterestShareCount url={'https://github.com/ayda-tech/react-share-kit'} />
<PinterestShareCount url={'https://github.com/ayda-tech/react-share-kit'}>
{shareCount => <span className="wrapper">{shareCount}</span>}
</PinterestShareCount>
π Props
url | string | | The URL of the shared page. | β
|
children | node | | React component, HTML element or string. | β |
Tumblr
π¨βπ» Code
import { TumblrShareCount } from 'next-share-kit'
<TumblrShareCount url={'https://github.com/ayda-tech/react-share-kit'} />
<TumblrShareCount url={'https://github.com/ayda-tech/react-share-kit'}>
{shareCount => <span className="wrapper">{shareCount}</span>}
</TumblrShareCount>
π Props
url | string | | The URL of the shared page. | β
|
children | node | | React component, HTML element or string. | β |
VK
π¨βπ» Code
import { VKShareCount } from 'next-share-kit'
<VKShareCount url={'https://github.com/ayda-tech/react-share-kit'} />
<VKShareCount url={'https://github.com/ayda-tech/react-share-kit'}>
{shareCount => <span className="wrapper">{shareCount}</span>}
</VKShareCount>
π Props
url | string | | The URL of the shared page. | β
|
children | node | | React component, HTML element or string. | β |
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:
import React from 'react';
import { FacebookShareButton, TwitterShareButton } from 'react-share-kit';
const ShareButtons = () => {
const shareUrl = 'https://example.com';
const title = 'Check out this awesome website!';
return (
<FacebookShareButton url={shareUrl} quote={title} />
);
};
Documentation
For more information on how to use React-Share-Kit, including a full list of available share buttons and their props, please refer to the official documentation.
License
React-Share-Kit is licensed under the MIT License. See the LICENSE file for more details.