Skip to content

Latest commit

Β 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

React-Share-Lite

react-share-lite is a simple and easy-to-use library for adding social media share buttons to your React, Next and Preact applications. With react-share-lite, you can quickly integrate share buttons for popular social media platforms such as Facebook, X (formerly Twitter), LinkedIn, and more.

react-share-lite ships share buttons only β€” it does not include share-count components. If you want share count functionality in your React, Next.js, or Preact projects built with JavaScript and TypeScript, react-share-kit is the solution. It seamlessly enhances your applications, allowing users to easily track the popularity of your content.

downloads downloads

NPM npm bundle size JavaScript Style Guide

Share buttons screenshot


✨ What's new in v2.0.0

  • βš›οΈ React 19 ready β€” works with React 17, 18 and 19, including Next.js App Router server components.
  • πŸ†• New networks: XShare (the canonical X/Twitter button), BlueskyShare and ThreadsShare.
  • 🎨 Styleable at last β€” className, style and all other standard button attributes are forwarded to the underlying <button>.
  • 🧹 Dead networks removed: PocketShare (Pocket was shut down in July 2025) and WorkplaceShare (Meta Workplace was discontinued).

See the CHANGELOG for the full list, including breaking changes.

Requirements: React 17, 18 or 19.


Table of Contents

Installation

To install react-share-lite, simply run:

npm install react-share-lite

or

yarn add react-share-lite

πŸ“• 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.

Props Type Default Description Required
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
windowPosition string windowCenter Position of the share window: windowCenter or screenCenter. FALSE
blankTarget boolean false Open share window in a new tab if set to true (opened with noopener,noreferrer). 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
style CSSProperties Custom style for the underlying button element. FALSE
iconStyle CSSProperties Custom style for the icon. FALSE
iconFillColor string Icon fill color. FALSE
disabled boolean false Disables the click action and applies disabledStyle. FALSE
disabledStyle CSSProperties { opacity: 0.6 } Style applied to the button when disabled is true. FALSE
openShareDialogOnClick boolean true Open the share dialog on click. FALSE
onClick function Custom click handler, called with (event, shareLink). FALSE
beforeOnClick function Takes a function that returns a Promise to be fulfilled before opening the share dialog. FALSE
onShareWindowClose function Takes a function to be called after closing the share dialog. FALSE
resetButtonStyle boolean true Set to false to keep the browser's default button styling. FALSE
forwardedRef Ref Ref forwarded to the underlying button element. FALSE

πŸ’… Styling: All standard button HTML attributes β€” className, style, aria-*, data-*, event handlers, etc. β€” are forwarded to the underlying <button> element, so you can style the buttons with your own CSS classes:

<FacebookShare url={shareUrl} className="my-share-button" data-testid="fb-share" />

πŸ‘¨β€πŸ’» Example

import React from 'react'
import { FacebookShare } from 'react-share-lite'

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

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

πŸ’‘ Usage of ShareButtons

Facebook Share

πŸ‘¨β€πŸ’» Example

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

πŸ“• Props: Supports only on Facebook

Props Type Default Description Required
quote string A quote to be shared. FALSE
hashtag string Hashtag to be shared. FALSE

X Share

πŸ‘¨β€πŸ’» Example

import { XShare } from 'react-share-lite'

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

πŸ“• Props: Supports only on X

Props Type Default Description Required
via string A username to attribute the post to. FALSE
hashtags array An array of hashtags to be appended to the default post text. FALSE
related array An array of accounts related to the content of the shared URI. FALSE

Twitter Share (Deprecated)

⚠️ Deprecated: Twitter is now X. TwitterShare is kept as an alias of XShare β€” it renders the X logo and opens the X post intent (x.com/intent/post). Use XShare in new code.

πŸ‘¨β€πŸ’» Example

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

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

πŸ“• Props: Same as X Share.

Bluesky Share

πŸ‘¨β€πŸ’» Example

import { BlueskyShare } from 'react-share-lite'

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

πŸ“• Props: Supports only on Bluesky

Props Type Default Description Required
separator string A separator between the title and the URL. FALSE

Threads Share

πŸ‘¨β€πŸ’» Example

import { ThreadsShare } from 'react-share-lite'

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

Linkedin Share

πŸ‘¨β€πŸ’» Example

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

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

Whatsapp Share

πŸ‘¨β€πŸ’» Example

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

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

πŸ“• Props: Supports only on WhatsApp

Props Type Default Description Required
separator string FALSE

Telegram Share

πŸ‘¨β€πŸ’» Example

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

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

FacebookMessenger Share

πŸ‘¨β€πŸ’» Example

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

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

πŸ“• Props: Supports only on Facebook Messenger

Props Type Default Description Required
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

Email Share

πŸ‘¨β€πŸ’» Example

import { EmailShare } from 'react-share-lite'

<EmailShare
  url={'https://github.com/ayda-tech/react-share-lite'}
  subject={'React Share Lite'}
  body="body"
/>

πŸ“• Props: Supports only on Email

Props Type Default Description Required
subject string The subject of the email. FALSE
body string The body of the email. FALSE
separator string A separator between the email body and the URL. FALSE

VK Share

πŸ‘¨β€πŸ’» Example

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

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

πŸ“• Props: Supports only on VK

Props Type Default Description Required
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

Pinterest Share

πŸ‘¨β€πŸ’» Example

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

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

πŸ“• Props: Supports only on Pinterest

Props Type Default Description Required
media string The image URL that will be pinned. TRUE
description string The description of the shared media. FALSE

Reddit Share

πŸ‘¨β€πŸ’» Example

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

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

Line Share

πŸ‘¨β€πŸ’» Example

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

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

Tumblr Share

πŸ‘¨β€πŸ’» Example

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

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

πŸ“• Props: Supports only on Tumblr

Props Type Default Description Required
tags Array<string> An array of tags to be shared. FALSE
caption string The description of the shared page. FALSE
posttype string link The type of the post. FALSE

Viber Share

πŸ‘¨β€πŸ’» Example

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

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

πŸ“• Props: Supports only on Viber

Props Type Default Description Required
separator string FALSE

Weibo Share

πŸ‘¨β€πŸ’» Example

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

<WeiboShare
  url={'https://github.com/ayda-tech/react-share-lite'}
  title={'react-share-lite - social share buttons for next & react apps.'}
  image={'https://github.com/ayda-tech/react-share-lite/blob/main/react-share-lite.png?raw=true'}
/>

πŸ“• Props: Supports only on Weibo

Props Type Default Description Required
image string The image URL that will be shared. FALSE

Mailru Share

πŸ‘¨β€πŸ’» Example

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

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

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

Props Type Default Description Required
description string Description of the shared page. FALSE
imageUrl string Image url of the shared page. FALSE

LiveJournal Share

πŸ‘¨β€πŸ’» Example

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

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

πŸ“• Props: Supports only on Live Journal

Props Type Default Description Required
description string Description of the shared page. FALSE

Instapaper Share

πŸ‘¨β€πŸ’» Example

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

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

πŸ“• Props: Supports only on Instapaper

Props Type Default Description Required
description string Description of the shared page. FALSE

Hatena Share

πŸ‘¨β€πŸ’» Example

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

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

Gab Share

πŸ‘¨β€πŸ’» Example

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

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

FAQ

Why doesn't my shared link show an image preview?

Link previews (image, title, description) are generated by the social network from the Open Graph / Twitter Card meta tags of the shared page itself β€” not by this library. If a preview is missing or wrong, add the proper og:* / twitter:* meta tags to the page you are sharing.

License

react-share-lite is licensed under the MIT License. See the LICENSE file for more details.

About

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

Topics

Resources

Stars

16 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages