next-share
Social media share buttons for your next React apps.



๐ Features
- No dependencies
- Compatible with both JavaScript and TypeScript
- Share buttons for your next React app
- Facebook
- Line
- Pinterest
- Reddit
- Telegram
- Tumblr
- Twitter
- Viber
- Weibo
- Whatsapp
- Linkedin
- VKShare
- Mailru
- Livejournal
- Workplace
- Pocket
- Instapaper
- Hatena
- FacebookMessenger
- Email
- Gab
- Share counts
- FacebookShareCount
- HatenaShareCount
- OKShareCount
- PinterestShareCount
- TumblrShareCount
- VKShareCount
- Icons
๐ง Install
next-share is available on npm. It can be installed with the following command:
npm install next-share --save
next-share is available on yarn as well. It can be installed with the following command:
yarn add next-share --save
๐ก Usage of ShareButton
๐ Facebook
๐จโ๐ป Code
import {
FacebookShareButton,
FacebookIcon,
} from 'next-share'
<FacebookShareButton
url={'https://github.com/next-share'}
quote={'next-share is a social share buttons for your next React apps.'}
hashtag={'#nextshare'}
>
<FacebookIcon size={32} round />
</FacebookShareButton>
๐ FacebookShareButton Props
| Props |
Type |
Default |
Description |
Required |
| 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. |
โ |
๐ Line
๐จโ๐ป Code
import {
LineShareButton,
LineIcon,
} from 'next-share'
<LineShareButton
url={'https://github.com/next-share'}
title={'next-share is a social share buttons for your next React apps.'}
>
<LineIcon />
</LineShareButton>
๐ LineShareButton Props
| Props |
Type |
Default |
Description |
Required |
| 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. |
โ |
๐ Pinterest
๐จโ๐ป Code
import {
PinterestShareButton,
PinterestIcon,
} from 'next-share'
<PinterestShareButton
url={'https://github.com/next-share'}
media={'next-share is a social share buttons for your next React apps.'}
>
<PinterestIcon size={32} round />
</PinterestShareButton>
๐ PinterestShareButton Props
| Props |
Type |
Default |
Description |
Required |
| 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. |
โ |
๐ Reddit
๐จโ๐ป Code
import {
RedditShareButton,
RedditIcon,
} from 'next-share'
<RedditShareButton
url={'https://github.com/next-share'}
title={'next-share is a social share buttons for your next React apps.'}
>
<RedditIcon size={32} round />
</RedditShareButton>
๐ RedditShareButton Props
| Props |
Type |
Default |
Description |
Required |
| 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. |
โ |
๐ Telegram
๐จโ๐ป Code
import {
TelegramShareButton,
TelegramIcon,
} from 'next-share'
<TelegramShareButton
url={'https://github.com/next-share'}
title={'next-share is a social share buttons for your next React apps.'}
>
<TelegramIcon size={32} round />
</TelegramShareButton>
๐ TelegramShareButton Props
| Props |
Type |
Default |
Description |
Required |
| 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. |
โ |
๐ Tumblr
๐จโ๐ป Code
import {
TumblrShareButton,
TumblrIcon,
} from 'next-share'
<TumblrShareButton
url={'https://github.com/next-share'}
title={'next-share is a social share buttons for your next React apps.'}
>
<TumblrIcon size={32} round />
</TumblrShareButton>
๐ TumblrShareButton Props
| Props |
Type |
Default |
Description |
Required |
| 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. |
โ |
๐ Twitter
๐จโ๐ป Code
import {
TwitterShareButton,
TwitterIcon,
} from 'next-share'
<TwitterShareButton
url={'https://github.com/next-share'}
title={'next-share is a social share buttons for your next React apps.'}
>
<TwitterIcon size={32} round />
</TwitterShareButton>
๐ TwitterShareButton Props
| Props |
Type |
Default |
Description |
Required |
| 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. |
โ |
๐ Viber
๐จโ๐ป Code
import {
ViberShareButton,
ViberIcon,
} from 'next-share'
<ViberShareButton
url={'https://github.com/next-share'}
title={'next-share is a social share buttons for your next React apps.'}
>
<ViberIcon size={32} round />
</ViberShareButton>
๐ ViberShareButton Props
| Props |
Type |
Default |
Description |
Required |
| 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. |
โ |
๐ Weibo
๐จโ๐ป Code
import {
WeiboShareButton,
WeiboIcon,
} from 'next-share'
<WeiboShareButton
url={'https://github.com/next-share'}
title={'next-share is a social share buttons for your next React apps.'}
image={`${String(window.location)}/${example-image}`}
>
<WeiboIcon size={32} round />
</WeiboShareButton>
๐ WeiboShareButton Props
| Props |
Type |
Default |
Description |
Required |
| 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. |
โ |
๐ Whatsapp
๐จโ๐ป Code
import {
WhatsappShareButton,
WhatsappIcon,
} from 'next-share'
<WhatsappShareButton
url={'https://github.com/next-share'}
title={'next-share is a social share buttons for your next React apps.'}
separator=":: "
>
<WhatsappIcon size={32} round />
</WhatsappShareButton>
๐ WhatsappShareButton Props
| Props |
Type |
Default |
Description |
Required |
| 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. |
โ |
๐ Linkedin
๐จโ๐ป Code
import {
LinkedinShareButton,
LinkedinIcon,
} from 'next-share'
<LinkedinShareButton url={'https://github.com/next-share'}>
<LinkedinIcon size={32} round />
</LinkedinShareButton>
๐ LinkedinShareButton Props
| Props |
Type |
Default |
Description |
Required |
| 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. |
โ |
How do you use things like title, summary, etc.?
Use og tags in the <head> block of the HTML.
<meta property='og:image' content='' />
<meta property='og:title' content='' />
<meta property='og:description' content='' />
๐ VK
๐จโ๐ป Code
import {
VKShareButton,
VKIcon,
} from 'next-share'
<VKShareButton
url={'https://github.com/next-share'}
image={'./next-share.png'}
>
<VKIcon size={32} round />
</VKShareButton>
๐ VKShareButton Props
| Props |
Type |
Default |
Description |
Required |
| 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. |
โ |
๐ Mailru
๐จโ๐ป Code
import {
MailruShareButton,
MailruIcon,
} from 'next-share'
<MailruShareButton
url={'https://github.com/next-share'}
title={'Next Share'}
>
<MailruIcon size={32} round />
</MailruShareButton>
๐ MailruShareButton Props
| Props |
Type |
Default |
Description |
Required |
| 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. |
โ |
๐ Livejournal
๐จโ๐ป Code
import {
LivejournalShareButton,
LivejournalIcon,
} from 'next-share'
<LivejournalShareButton
url={'https://github.com/next-share'}
title={'Next Share'}
description={'https://github.com/next-share'}
>
<LivejournalIcon size={32} round />
</LivejournalShareButton>
๐ LivejournalShareButton Props
| Props |
Type |
Default |
Description |
Required |
| 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. |
โ |
๐ Workplace
๐จโ๐ป Code
import {
WorkplaceShareButton,
WorkplaceIcon,
} from 'next-share'
<WorkplaceShareButton
url={'https://github.com/next-share'}
quote={'Next Share'}
>
<WorkplaceIcon size={32} round />
</WorkplaceShareButton>
๐ WorkplaceShareButton Props
| Props |
Type |
Default |
Description |
Required |
| 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. |
โ |
๐ Pocket
๐จโ๐ป Code
import {
PocketShareButton,
PocketIcon,
} from 'next-share'
<PocketShareButton
url={'https://github.com/next-share'}
title={'Next Share'}
>
<PocketIcon size={32} round />
</PocketShareButton>
๐ PocketShareButton Props
| Props |
Type |
Default |
Description |
Required |
| 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. |
โ |
๐ Instapaper
๐จโ๐ป Code
import {
InstapaperShareButton,
InstapaperIcon,
} from 'next-share'
<InstapaperShareButton
url={'https://github.com/next-share'}
title={'Next Share'}
>
<InstapaperIcon size={32} round />
</InstapaperShareButton>
๐ InstapaperShareButton Props
| Props |
Type |
Default |
Description |
Required |
| 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. |
โ |
๐ Hatena
๐จโ๐ป Code
import {
HatenaShareButton,
HatenaIcon,
} from 'next-share'
<HatenaShareButton
url={'https://github.com/next-share'}
title={'Next Share'}
>
<HatenaIcon size={32} round />
</HatenaShareButton>
๐ HatenaShareButton Props
| Props |
Type |
Default |
Description |
Required |
| 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. |
โ |
๐ FacebookMessenger
๐จโ๐ป Code
import {
FacebookMessengerShareButton,
FacebookMessengerIcon,
} from 'next-share'
<FacebookMessengerShareButton
url={'https://github.com/next-share'}
appId={''}
>
<FacebookMessengerIcon size={32} round />
</FacebookMessengerShareButton>
๐ FacebookMessengerShareButton Props
| Props |
Type |
Default |
Description |
Required |
| 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. |
โ |
๐ Email
๐จโ๐ป Code
import {
EmailShareButton,
EmailIcon,
} from 'next-share'
<EmailShareButton
url={'https://github.com/next-share'}
subject={'Next Share'}
body="body"
>
<EmailIcon size={32} round />
</EmailShareButton>
๐ EmailShareButton Props
| Props |
Type |
Default |
Description |
Required |
| 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. |
โ |
๐ Gab
๐จโ๐ป Code
import {
GabShareButton,
GabIcon,
} from 'next-share'
<GabShareButton
url={'https://github.com/next-share'}
title={'Next Share'}
>
<GabIcon size={32} round />
</GabShareButton>
๐ GabShareButton Props
| Props |
Type |
Default |
Description |
Required |
| 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. |
โ |
๐ Icons Props
| Props |
Type |
Default |
Description |
Required |
| size |
number |
|
Icon size in pixels. |
โ |
| round |
boolean |
|
Show round or rectangle. |
โ |
| borderRadius |
number |
|
Set rounded corners if using round icon. |
โ |
| bgStyle |
object |
|
Customize background style. |
โ |
| iconFillColor |
string |
white |
Customize icon fill color. |
โ |
| blankTarget |
boolean |
false |
Open share window in a new tab if set to true. |
โ |
๐ก Usage of ShareCount
๐ Facebook
๐จโ๐ป Code
import { FacebookShareCount } from 'next-share'
<FacebookShareCount
url={'https://github.com/next-share'}
appId={''}
appSecret={''}
/>
<FacebookShareCount
url={'https://github.com/next-share'}
appId={''}
appSecret={''}
>
{shareCount => <span className="wrapper">{shareCount}</span>}
</FacebookShareCount>
๐ FacebookShareCount Props
| Props |
Type |
Default |
Description |
Required |
| 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'
<HatenaShareCount url={'https://github.com/next-share'} />
<HatenaShareCount url={'https://github.com/next-share'}>
{shareCount => <span className="wrapper">{shareCount}</span>}
</HatenaShareCount>
๐ HatenaShareCount Props
| Props |
Type |
Default |
Description |
Required |
| url |
string |
|
The URL of the shared page. |
โ
|
| children |
node |
|
React component, HTML element or string. |
โ |
๐ OK
๐จโ๐ป Code
import { OKShareCount } from 'next-share'
<OKShareCount url={'https://github.com/next-share'} />
<OKShareCount url={'https://github.com/next-share'}>
{shareCount => <span className="wrapper">{shareCount}</span>}
</OKShareCount>
๐ OKShareCount Props
| Props |
Type |
Default |
Description |
Required |
| url |
string |
|
The URL of the shared page. |
โ
|
| children |
node |
|
React component, HTML element or string. |
โ |
๐ Pinterest
๐จโ๐ป Code
import { PinterestShareCount } from 'next-share'
<PinterestShareCount url={'https://github.com/next-share'} />
<PinterestShareCount url={'https://github.com/next-share'}>
{shareCount => <span className="wrapper">{shareCount}</span>}
</PinterestShareCount>
๐ PinterestShareCount Props
| Props |
Type |
Default |
Description |
Required |
| url |
string |
|
The URL of the shared page. |
โ
|
| children |
node |
|
React component, HTML element or string. |
โ |
๐ Tumblr
๐จโ๐ป Code
import { TumblrShareCount } from 'next-share'
<TumblrShareCount url={'https://github.com/next-share'} />
<TumblrShareCount url={'https://github.com/next-share'}>
{shareCount => <span className="wrapper">{shareCount}</span>}
</TumblrShareCount>
๐ TumblrShareCount Props
| Props |
Type |
Default |
Description |
Required |
| url |
string |
|
The URL of the shared page. |
โ
|
| children |
node |
|
React component, HTML element or string. |
โ |
๐ VK
๐จโ๐ป Code
import { VKShareCount } from 'next-share'
<VKShareCount url={'https://github.com/next-share'} />
<VKShareCount url={'https://github.com/next-share'}>
{shareCount => <span className="wrapper">{shareCount}</span>}
</VKShareCount>
๐ VKShareCount Props
| Props |
Type |
Default |
Description |
Required |
| url |
string |
|
The URL of the shared page. |
โ
|
| children |
node |
|
React component, HTML element or string. |
โ |
๐ก Usage of Icon
๐จโ๐ป Code
import {
EmailIcon,
FacebookIcon,
FacebookMessengerIcon,
GithubIcon,
HatenaIcon,
InstagramIcon,
InstapaperIcon,
LineIcon,
LinkedinIcon,
LivejournalIcon,
MailruIcon,
OKIcon,
PinterestIcon,
PocketIcon,
RedditIcon,
SpotifyIcon,
TelegramIcon,
TumblrIcon,
TwitterIcon,
ViberIcon,
VKIcon,
WeiboIcon,
WhatsappIcon,
WorkplaceIcon,
} from 'next-share'
๐ Props
| Props |
Type |
Default |
Description |
Required |
| size |
number |
|
Icon size in pixels. |
โ |
| round |
boolean |
|
Whether to show round or rect icons. |
โ |
| borderRadius |
number |
|
Allow rounded corners if using rect icons. |
โ |
| bgStyle |
object |
|
Customize background. |
โ |
| iconFillColor |
string |
white |
Customize icon fill color. |
โ |
๐ Changelog
Latest version 0.27.0 (2023-09-28):
Details changes for each release are documented in the CHANGELOG.md.
๐ Wrap Up
If you think any of the next-share can be improved, please do open a PR with any updates and submit any issues. Also, I will continue to improve this, so you might want to watch/star this repository to revisit.
๐ Contribution
We'd love to have your helping hand on contributions to next-share by forking and sending a pull request!
Your contributions are heartily โก welcome, recognized and appreciated. (โฟโ โฟโ )
How to contribute:
- Open pull request with improvements
- Discuss ideas in issues
- Spread the word
- Reach out with any feedback
โจ Contributors
๐จโ๐ฉโ๐ฆ Advertisement
You maybe interested.
- React Patterns โ React patterns & techniques to use in development for React Developer.
- React Papaparse โ The fastest in-browser CSV (or delimited text) parser for React.
- Next QRCode โ React hooks for generating QR code for your next React apps.
- Next Time Ago โ A lightweight tiny time-ago component for your next React apps.
โ๏ธ License
The MIT License 