React share buttons for websites, blogs, docs and landing pages.
npm install share-button-links-reactor
yarn add share-button-links-reactimport {
ButtonCopy,
ButtonEmail,
ButtonFacebook,
ButtonLinkedIn,
ButtonPinterest,
ButtonPocket,
ButtonReddit,
ButtonTelegram,
ButtonTumblr,
ButtonTwitter,
ButtonWhatsapp
} from "share-button-links-react";import {
CopyIcon,
EmailIcon,
FacebookIcon,
LinkedInIcon,
PinterestIcon,
PocketIcon,
RedditIcon,
TelegramIcon,
TumblrIcon,
TwitterIcon,
WhatsappIcon
} from "share-button-links-react";import { ButtonGroup } from "share-button-links-react";The package ships with compiled CSS and the original SCSS entry.
@import "share-button-links-react/dist/share-button-links-react.css";@use "share-button-links-react/dist/share-button-links-react.scss";import { ButtonFacebook, TwitterIcon, ButtonGroup } from "share-button-links-react";
export function Example() {
return (
<>
<ButtonFacebook
url="https://example.com/article"
title="A shareable article"
text="Facebook"
hasIcon
isRounded
colorVariant="neutral"
/>
<TwitterIcon
url="https://example.com/article"
title="A shareable article"
isCircled
colorVariant="flat"
/>
<ButtonGroup
url="https://example.com/article"
title="A shareable article"
message="Take a look at this"
description="Reusable React share buttons"
mediaUrl="https://example.com/cover.png"
content="Extra text for Tumblr or email"
subject="Check this out"
isRounded
colorVariant="neutral"
facebookIcon
twitterIcon
telegramIcon
whatsappIcon
copyIcon
/>
</>
);
}Most button and icon components support:
isRounded?: booleanisCircled?: booleanisBordered?: booleancolorVariant?: "brand" | "flat" | "neutral"
Text buttons also support:
hasIcon?: boolean
Icon buttons also support:
isAllWhite?: booleanisWhited?: boolean
ButtonCopy and CopyIcon support:
url?: stringto copy a specific URL.copiedLabel?: stringto customize the success message.
All share components support:
validateUrl?: booleanto require absolutehttp/httpsURLs.fallbackUrl?: stringused when validation is enabled and the provided URL is invalid.
Some components need extra data depending on the destination:
titlefor Facebook, Twitter, Reddit, Pocket and Tumblr.messagefor WhatsApp and Telegram.descriptionandmediaUrlfor Pinterest.to,subjectandcontentfor Email.contentfor Tumblr.
The repository includes an isolated playground outside of the library build.
npm run devUseful commands:
npm run buildbuilds the library.npm run build:playgroundbuilds the playground.npm testruns the test suite.
Documentation site: share-button-links-react-docs.vercel.app