Gathering detailed insights and metrics for -adisagar2003-react-share-on-social
Gathering detailed insights and metrics for -adisagar2003-react-share-on-social
Gathering detailed insights and metrics for -adisagar2003-react-share-on-social
Gathering detailed insights and metrics for -adisagar2003-react-share-on-social
Native sharing using the Web Share API if supported, a beautiful fallback if not. 😎
npm install -adisagar2003-react-share-on-social
Typescript
Module System
Node Version
NPM Version
73.3
Supply Chain
98.6
Quality
74.8
Maintenance
100
Vulnerability
100
License
TypeScript (91.29%)
CSS (3.85%)
JavaScript (3.59%)
HTML (1.04%)
Shell (0.24%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
1,109
Last Day
1
Last Week
42
Last Month
78
Last Year
601
16 Stars
38 Commits
7 Forks
1 Watching
6 Branches
1 Contributors
Latest Version
1.0.9
Package Id
-adisagar2003-react-share-on-social@1.0.9
Unpacked Size
332.18 kB
Size
91.84 kB
File Count
35
NPM Version
8.19.2
Node Version
16.18.0
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
4,100%
42
Compared to previous week
Last month
609.1%
78
Compared to previous month
Last year
63.8%
601
Compared to previous year
1
1
23
:smiling_face_with_three_hearts::stuck_out_tongue_winking_eye::money_mouth_face::sunglasses::partying_face:
Native sharing if supported, beautiful fallback if not.
A ~8kb
package for effortless social media sharing, originally forked from react-web-share.
1npm install react-share-on-social
or, if you're using yarn:
1yarn add react-share-on-social
Passing the linkFavicon
prop drastically improves UX for devices that use the fallback. Without linkFavicon
, the fallback renders a grey box instead.
Note: The Web Share API only works in secure contexts (HTTPS). Read more here.
1import React from "react"; 2import ShareOnSocial from "react-share-on-social"; 3import favicon from "../assets/favicon.png"; 4 5const Example = () => { 6 return ( 7 <ShareOnSocial 8 textToShare="Check out this new wardrobe I just found from IKEA!" 9 link="https://ikea.com/wardrobes/kalle" 10 linkTitle="KALLE Wardorbe which chooses your clothes for you using AI - IKEA" 11 linkMetaDesc="Stop going through the agony of choosing clothes that fit the weather and your mood." 12 linkFavicon={favicon} 13 noReferer 14 > 15 <button>Share this product</button> 16 </ShareOnSocial> 17 ); 18};
Property | Type | Description |
---|---|---|
textToShare | string | The text that appears in the post. |
link | URL | The URL to share. |
linkTitle | string | The link title which should correspond to the <title> tag. |
linkMetaDesc | string | The meta description of the link, should correspond to the <meta og:description> tag. |
linkFavicon | HTMLImageElement | A small image which is shown in the header of th popup fallback. |
Property | Type | Default | Description |
---|---|---|---|
shareTo | Array<string> | ["facebook", "twitter", ... , "email"] | A list of all social media channels that should appear in the fallback. |
noReferer | boolean | false | If the social media buttons should have a noreferrer tag or not. |
backdropColor | string | rgba(0,0,0,0.4) | The background color of the backdrop. |
closeText | string | Close | The label of the close button. |
copyToClipboardText | string | Copy to clipboard | The label of the copy to clipboard button. |
copySuccessText | string | Copied | The label of the copy to clipboard button after a successful copy. |
onSocialClick | () => void | () => null | A callback invoked when user clicks on any of the social media buttons in the fallback. |
The supported props are passed in the sharing URL to each service, and will appear in the post draft.
Social media | Supported props |
---|---|
link | |
link , textToShare | |
link | |
link , textToShare | |
link , linkTitle , textToShare | |
link | |
Telegram | link , textToShare |
link , textToShare |
react-share-on-social
and react-web-share
?The fallback is more rich with a header and an improved copy-to-clipboard functionality
Props are restructured for better usability
Pinterest is supported
Social media services are opened in a minimal window instead of a new tab
So you want to contribute? Good, the world needs more brave troopers like you. Contributions are what makes the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated by us and the community.
If you find a typo, bug or want to add a feature, create an issue or add a pull request with the code you want to add!
Regarding bugs, please make sure that your issue is:
Reproducible. Include steps to reproduce the problem.
Specific. Include as much detail as possible: which device you use, how you have interacted with the website, etc.
Scoped to a Single Bug. One bug per issue.
No vulnerabilities found.
No security vulnerabilities found.