0.27.0 • Published 7 months ago

next-share v0.27.0

Weekly downloads
321
License
MIT
Repository
github
Last release
7 months ago

next-share

Social media share buttons for your next React apps.

downloads downloads

NPM npm bundle size Build Status JavaScript Style Guide

🎁 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

PropsTypeDefaultDescriptionRequired
childrennodeReact component, HTML element or string.
urlstringThe URL of the shared page.
quotestringA quote to be shared.
hashtagstringHashtag to be shared.
windowWidthnumber550Opened window width.
windowHeightnumber400Opened window height.
blankTargetbooleanfalseOpen share window in a new tab if set to true.

📖 FacebookIcon Props

🎀 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

PropsTypeDefaultDescriptionRequired
childrennodeReact component, HTML element or string.
urlstringThe URL of the shared page.
titlestringThe title of the shared page.
windowWidthnumber500Opened window width.
windowHeightnumber500Opened window height.
blankTargetbooleanfalseOpen share window in a new tab if set to true.

📖 LineIcon props

🎀 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

PropsTypeDefaultDescriptionRequired
childrennodeReact component, HTML element or string.
urlstringThe URL of the shared page.
mediastringThe image URL that will be pinned.
descriptionstringThe description of the shared media.
windowWidthnumber1000Opened window width.
windowHeightnumber730Opened window height.
blankTargetbooleanfalseOpen share window in a new tab if set to true.

📖 PinterestIcon Props

🎀 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

PropsTypeDefaultDescriptionRequired
childrennodeReact component, HTML element or string.
urlstringThe URL of the shared page.
titlestringThe title of the shared page.
windowWidthnumber660Opened window width.
windowHeightnumber460Opened window height.
blankTargetbooleanfalseOpen share window in a new tab if set to true.

📖 RedditIcon Props

🎀 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

PropsTypeDefaultDescriptionRequired
childrennodeReact component, HTML element or string.
urlstringThe URL of the shared page.
titlestringThe title of the shared page.
windowWidthnumber550Opened window width.
windowHeightnumber400Opened window height.
blankTargetbooleanfalseOpen share window in a new tab if set to true.

📖 TelegramIcon Props

🎀 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

PropsTypeDefaultDescriptionRequired
childrennodeReact component, HTML element or string.
urlstringThe URL of the shared page.
titlestringThe title of the shared page.
tagsArray<string>
captionstringThe description of the shared page.
posttypestringlink
windowWidthnumber660Opened window width.
windowHeightnumber460Opened window height.
blankTargetbooleanfalseOpen share window in a new tab if set to true.

📖 TumblrIcon Props

🎀 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

PropsTypeDefaultDescriptionRequired
childrennodeReact component, HTML element or string.
urlstringThe URL of the shared page.
titlestringThe title of the shared page.
viastring
hashtagsarray
relatedarray
windowWidthnumber550Opened window width.
windowHeightnumber400Opened window height.
blankTargetbooleanfalseOpen share window in a new tab if set to true.

📖 TwitterIcon Props

🎀 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

PropsTypeDefaultDescriptionRequired
childrennodeReact component, HTML element or string.
urlstringThe URL of the shared page.
titlestringThe title of the shared page.
separator
windowWidthnumber660Opened window width.
windowHeightnumber460Opened window height.
blankTargetbooleanfalseOpen share window in a new tab if set to true.

📖 ViberIcon Props

🎀 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

PropsTypeDefaultDescriptionRequired
childrennodeReact component, HTML element or string.
urlstringThe URL of the shared page.
titlestringThe title of the shared page.
imagestringThe image URL that will be shared.
windowWidthnumber660Opened window width.
windowHeightnumber550Opened window height.
blankTargetbooleanfalseOpen share window in a new tab if set to true.

📖 WeiboIcon Props

🎀 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

PropsTypeDefaultDescriptionRequired
childrennodeReact component, HTML element or string.
urlstringThe URL of the shared page.
titlestringThe title of the shared page.
separatorstring
windowWidthnumber550Opened window width.
windowHeightnumber400Opened window height.
blankTargetbooleanfalseOpen share window in a new tab if set to true.

📖 WhatsappIcon Props

🎀 Linkedin

👨‍💻 Code

import {
  LinkedinShareButton,
  LinkedinIcon,
} from 'next-share'

<LinkedinShareButton url={'https://github.com/next-share'}>
  <LinkedinIcon size={32} round />
</LinkedinShareButton>

📖 LinkedinShareButton Props

PropsTypeDefaultDescriptionRequired
childrennodeReact component, HTML element or string.
urlstringThe URL of the shared page.
windowWidthnumber750Opened window width.
windowHeightnumber600Opened window height.
blankTargetbooleanfalseOpen share window in a new tab if set to true.
<!--titlestringThe title of the shared page.
summarystringDescription of the shared page.
sourcestringSource of the content (e.g. your website or application name).-->

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='' />

📖 LinkedinIcon Props

🎀 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

PropsTypeDefaultDescriptionRequired
childrennodeReact component, HTML element or string.
urlstringThe URL of the shared page.
titlestringThe title of the shared page.
imagestringAn absolute link to the image that will be shared.
noParsebooleanIf true is passed, VK will not retrieve URL information.
noVkLinksbooleanIf true is passed, there will be no links to the user's profile in the open window. Only for mobile devices.
windowWidthnumber660Opened window width.
windowHeightnumber460Opened window height.
blankTargetbooleanfalseOpen share window in a new tab if set to true.

📖 VKIcon Props

🎀 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

PropsTypeDefaultDescriptionRequired
childrennodeReact component, HTML element or string.
urlstringThe URL of the shared page.
titlestringThe title of the shared page.
descriptionstringDescription of the shared page.
imageUrlstringImage url of the shared page.
windowWidthnumber660Opened window width.
windowHeightnumber460Opened window height.
blankTargetbooleanfalseOpen share window in a new tab if set to true.

📖 MailruIcon Props

🎀 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

PropsTypeDefaultDescriptionRequired
childrennodeReact component, HTML element or string.
urlstringThe URL of the shared page.
titlestringThe title of the shared page.
descriptionstringDescription of the shared page.
windowWidthnumber660Opened window width.
windowHeightnumber460Opened window height.
blankTargetbooleanfalseOpen share window in a new tab if set to true.

📖 LivejournalIcon Props

🎀 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

PropsTypeDefaultDescriptionRequired
childrennodeReact component, HTML element or string.
urlstringThe URL of the shared page.
quotestring
hashtagstring
windowWidthnumber550Opened window width.
windowHeightnumber400Opened window height.
blankTargetbooleanfalseOpen share window in a new tab if set to true.

📖 WorkplaceIcon Props

🎀 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

PropsTypeDefaultDescriptionRequired
childrennodeReact component, HTML element or string.
urlstringThe URL of the shared page.
titlestringTitle 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.
windowWidthnumber500Opened window width.
windowHeightnumber500Opened window height.
blankTargetbooleanfalseOpen share window in a new tab if set to true.

📖 PocketIcon Props

🎀 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

PropsTypeDefaultDescriptionRequired
childrennodeReact component, HTML element or string.
urlstringThe URL of the shared page.
titlestringTitle of the shared page.
descriptionstringDescription of the shared page.
windowWidthnumber500Opened window width.
windowHeightnumber500Opened window height.
blankTargetbooleanfalseOpen share window in a new tab if set to true.

📖 InstapaperIcon Props

🎀 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

PropsTypeDefaultDescriptionRequired
childrennodeReact component, HTML element or string.
urlstringThe URL of the shared page.
titlestringTitle of the shared page.
windowWidthnumber660Opened window width.
windowHeightnumber460Opened window height.
blankTargetbooleanfalseOpen share window in a new tab if set to true.

📖 HatenaIcon Props

🎀 FacebookMessenger

👨‍💻 Code

import {
  FacebookMessengerShareButton,
  FacebookMessengerIcon,
} from 'next-share'

<FacebookMessengerShareButton
  url={'https://github.com/next-share'}
  appId={''}
>
  <FacebookMessengerIcon size={32} round />
</FacebookMessengerShareButton>

📖 FacebookMessengerShareButton Props

PropsTypeDefaultDescriptionRequired
childrennodeReact component, HTML element or string.
urlstringThe URL of the shared page.
appIdstringFacebook application id.
redirectUristringThe URL to redirect to after sharing (default: the shared url).
tostringA user ID of a recipient. Once the dialog comes up, the sender can specify additional people as recipients.
windowWidthnumber1000Opened window width.
windowHeightnumber820Opened window height.
blankTargetbooleanfalseOpen share window in a new tab if set to true.

📖 FacebookMessengerIcon Props

🎀 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

PropsTypeDefaultDescriptionRequired
childrennodeReact component, HTML element or string.
urlstringThe URL of the shared page.
subjectstring
bodystring
separatorstring
blankTargetbooleanfalseOpen share window in a new tab if set to true.

📖 EmailIcon Props

🎀 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

PropsTypeDefaultDescriptionRequired
childrennodeReact component, HTML element or string.
urlstringThe URL of the shared page.
titlestringTitle of the shared page.
windowWidthnumber660Opened window width.
windowHeightnumber640Opened window height.

📖 GabIcon Props

📚 Icons Props

PropsTypeDefaultDescriptionRequired
sizenumberIcon size in pixels.
roundbooleanShow round or rectangle.
borderRadiusnumberSet rounded corners if using round icon.
bgStyleobjectCustomize background style.
iconFillColorstringwhiteCustomize icon fill color.
blankTargetbooleanfalseOpen 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

PropsTypeDefaultDescriptionRequired
urlstringThe URL of the shared page.
appIdstringFacebook application id.
appSecretstringFacebook application secret.
childrennodeReact 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

PropsTypeDefaultDescriptionRequired
urlstringThe URL of the shared page.
childrennodeReact 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

PropsTypeDefaultDescriptionRequired
urlstringThe URL of the shared page.
childrennodeReact 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

PropsTypeDefaultDescriptionRequired
urlstringThe URL of the shared page.
childrennodeReact 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

PropsTypeDefaultDescriptionRequired
urlstringThe URL of the shared page.
childrennodeReact 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

PropsTypeDefaultDescriptionRequired
urlstringThe URL of the shared page.
childrennodeReact 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

PropsTypeDefaultDescriptionRequired
sizenumberIcon size in pixels.
roundbooleanWhether to show round or rect icons.
borderRadiusnumberAllow rounded corners if using rect icons.
bgStyleobjectCustomize background.
iconFillColorstringwhiteCustomize icon fill color.

📜 Changelog

Latest version 0.27.0 (2023-09-28):

  • Upgrade TwitterIcon

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 License: MIT

0.27.0

7 months ago

0.21.0

10 months ago

0.25.0

9 months ago

0.24.0

10 months ago

0.22.2

10 months ago

0.23.0

10 months ago

0.22.1

10 months ago

0.22.0

10 months ago

0.21.1

10 months ago

0.20.0

1 year ago

0.19.0

2 years ago

0.18.2

2 years ago

0.18.4

2 years ago

0.18.1

2 years ago

0.14.0

2 years ago

0.16.0

2 years ago

0.17.0

2 years ago

0.18.0

2 years ago

0.17.1

2 years ago

0.13.0

2 years ago

0.12.2

3 years ago

0.12.1

3 years ago

0.11.0

3 years ago

0.12.0

3 years ago

0.10.0

3 years ago

0.9.0

3 years ago

0.8.0

3 years ago

0.7.0

3 years ago

0.1.0

3 years ago

0.3.0

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.5.0

3 years ago

0.4.0

3 years ago

0.6.0

3 years ago

0.0.1

4 years ago

0.0.2

4 years ago

0.0.0

4 years ago