share-button-links-react
v2.3.3
Published
Share buttons links for websites, blogs and more.
Downloads
356
Maintainers
Readme
Share Button Links React
React share buttons for websites, blogs, docs and landing pages.
Installation
npm install share-button-links-reactor
yarn add share-button-links-reactExports
Buttons
import {
ButtonCopy,
ButtonEmail,
ButtonFacebook,
ButtonLinkedIn,
ButtonPinterest,
ButtonPocket,
ButtonReddit,
ButtonTelegram,
ButtonTumblr,
ButtonTwitter,
ButtonWhatsapp
} from "share-button-links-react";Icon Buttons
import {
CopyIcon,
EmailIcon,
FacebookIcon,
LinkedInIcon,
PinterestIcon,
PocketIcon,
RedditIcon,
TelegramIcon,
TumblrIcon,
TwitterIcon,
WhatsappIcon
} from "share-button-links-react";Button Group
import { ButtonGroup } from "share-button-links-react";Styles
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";Basic Usage
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
/>
</>
);
}Shared Visual Props
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
Copy Button Props
ButtonCopy and CopyIcon support:
url?: stringto copy a specific URL.copiedLabel?: stringto customize the success message.
URL Safety Props
All share components support:
validateUrl?: booleanto require absolutehttp/httpsURLs.fallbackUrl?: stringused when validation is enabled and the provided URL is invalid.
Network-Specific Props
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.
Local Development
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
Documentation site: share-button-links-react-docs.vercel.app
