1.1.1 β€’ Published 2 years ago

vue-share-buttons v1.1.1

Weekly downloads
260
License
MIT
Repository
github
Last release
2 years ago

vue-share-buttons

Vue component for placing buttons in your project using which you can share anything. If vue-share-buttons doesn't have a social network for you, just make a Pull request or create new issue for me

Menu

Installation

Install using npm

npm i vue-share-buttons

Link to NPM

Install using Yarn

yarn add vue-share-buttons

Link to Yarn

Icons

For icons, I use simpleicons

Usage

You need to import each social button separately. For example, you want to use the share button on Twitter. To do this you need:

Import component

import TwitterButton from "vue-share-buttons/src/components/TwitterButton";

const app = new Vue({
  el: "#app",
  components: {
    TwitterButton,
  },
});

Add the button to your template

<div id="app">
  <twitter-button
    url="https://github.com/"
    description="GitHub is where people build software."
  />
</div>

And we get the button

Options

Below are the options you can pass to create your own button.

Buttons with a counter

Facebook, LinkedIn

OptionType'sDefaultDescription
urlStringdocument.location.hrefURL-address you want to share
btnTextStringFacebook, LinkedIn, etc.Text to be written on your button
hasIconBooleantruePresence of social network icon in the button
isBlankBooleantrueOpen the "share on social networks" frame in a new window
modalWidthNumber500If the property "isBlank" is set to false, you can set the width of the modal window the "share on social networks"
modalHeightNumber500If the property "isBlank" is set to false, you can set the height of the modal window the "share on social networks"
hasCounterBooleanfalsePresence of a counter with the number of share
digitsCounterNumber0The number of decimal places in the counter
keyCounterString''Counter ID (note, it must be unique if you use several buttons with a counter for the same social network on the same page)
customIconString''Custom imag

Odnoklassniki

OptionType'sDefaultDescription
urlStringdocument.location.hrefURL-address you want to share
descriptionStringdocument.titleMessages you want to share
btnTextStringOdnoklassnikiText to be written on your button
hasIconBooleantruePresence of social network icon in the button
isBlankBooleantrueOpen the "share on social networks" frame in a new window
modalWidthNumber500If the property "isBlank" is set to false, you can set the width of the modal window the "share on social networks"
modalHeightNumber500If the property "isBlank" is set to false, you can set the height of the modal window the "share on social networks"
hasCounterBooleanfalsePresence of a counter with the number of share
digitsCounterNumber0The number of decimal places in the counter
customIconString''Custom image
sharePicString''Link to image instead of favicon

Tumblr

OptionType'sDefaultDescription
urlStringdocument.location.hrefURL-address you want to share
descriptionStringdocument.titleMessages you want to share
titleString''Title you want to share
btnTextStringTumblr, VkontakteText to be written on your button
hasIconBooleantruePresence of social network icon in the button
isBlankBooleantrueOpen the "share on social networks" frame in a new window
modalWidthNumber500If the property "isBlank" is set to false, you can set the width of the modal window the "share on social networks"
modalHeightNumber500If the property "isBlank" is set to false, you can set the height of the modal window the "share on social networks"
hasCounterBooleanfalsePresence of a counter with the number of share
digitsCounterNumber0The number of decimal places in the counter
keyCounterString''Counter ID (note, it must be unique if you use several buttons with a counter for the same social network on the same page)
customIconString''Custom image

Vkontakte

OptionType'sDefaultDescription
urlStringdocument.location.hrefURL-address you want to share
descriptionStringdocument.titleMessages you want to share
titleString''Title you want to share
btnTextStringTumblr, VkontakteText to be written on your button
hasIconBooleantruePresence of social network icon in the button
isBlankBooleantrueOpen the "share on social networks" frame in a new window
modalWidthNumber500If the property "isBlank" is set to false, you can set the width of the modal window the "share on social networks"
modalHeightNumber500If the property "isBlank" is set to false, you can set the height of the modal window the "share on social networks"
hasCounterBooleanfalsePresence of a counter with the number of share
digitsCounterNumber0The number of decimal places in the counter
sharePicString''Link to image instead of favicon
customIconString''Custom image

Pinterest

OptionType'sDefaultDescription
urlStringdocument.location.hrefURL-address you want to share
descriptionStringdocument.titleMessages you want to share
pictureString''Picture you want to share
btnTextStringPinterestText to be written on your button
hasIconBooleantruePresence of social network icon in the button
isBlankBooleantrueOpen the "share on social networks" frame in a new window
modalWidthNumber500If the property "isBlank" is set to false, you can set the width of the modal window the "share on social networks"
modalHeightNumber500If the property "isBlank" is set to false, you can set the height of the modal window the "share on social networks"
hasCounterBooleanfalsePresence of a counter with the number of share
digitsCounterNumber0The number of decimal places in the counter
keyCounterString''Counter ID (note, it must be unique if you use several buttons with a counter for the same social network on the same page)
customIconString''Custom image

Buttons without a counter

Twitter, Hatena, Instapaper, LiveJournal

OptionType'sDefaultDescription
urlStringdocument.location.hrefURL-address you want to share
descriptionStringdocument.titleMessages you want to share
btnTextStringTwitter, Hatena, Instapaper, LiveJournalText to be written on your button
hasIconBooleantruePresence of social network icon in the button
isBlankBooleantrueOpen the "share on social networks" frame in a new window
modalWidthNumber500If the property "isBlank" is set to false, you can set the width of the modal window the "share on social networks"
modalHeightNumber500If the property "isBlank" is set to false, you can set the height of the modal window the "share on social networks"
customIconString''Custom image

Digg, Xing, Pocket

OptionType'sDefaultDescription
urlStringdocument.location.hrefURL-address you want to share
btnTextStringDigg, Xing, PocketText to be written on your button
hasIconBooleantruePresence of social network icon in the button
isBlankBooleantrueOpen the "share on social networks" frame in a new window
modalWidthNumber500If the property "isBlank" is set to false, you can set the width of the modal window the "share on social networks"
modalHeightNumber500If the property "isBlank" is set to false, you can set the height of the modal window the "share on social networks"
customIconString''Custom image

Blogger

OptionType'sDefaultDescription
urlStringdocument.location.hrefURL-address you want to share
descriptionStringdocument.titleMessages you want to share
titleString''Title you want to share
btnTextStringBloggerText to be written on your button
hasIconBooleantruePresence of social network icon in the button
isBlankBooleantrueOpen the "share on social networks" frame in a new window
modalWidthNumber500If the property "isBlank" is set to false, you can set the width of the modal window the "share on social networks"
modalHeightNumber500If the property "isBlank" is set to false, you can set the height of the modal window the "share on social networks"
customIconString''Custom image

Reddit, Renren

OptionType'sDefaultDescription
urlStringdocument.location.hrefURL-address you want to share
titleString''Title you want to share
btnTextStringReddit, RenrenText to be written on your button
hasIconBooleantruePresence of social network icon in the button
isBlankBooleantrueOpen the "share on social networks" frame in a new window
modalWidthNumber500If the property "isBlank" is set to false, you can set the width of the modal window the "share on social networks"
modalHeightNumber500If the property "isBlank" is set to false, you can set the height of the modal window the "share on social networks"
customIconString''Custom image

Weibo

OptionType'sDefaultDescription
urlStringdocument.location.hrefURL-address you want to share
descriptionStringdocument.titleMessages you want to share
pictureString''Picture you want to share
titleString''Title you want to share
btnTextStringWeiboText to be written on your button
hasIconBooleantruePresence of social network icon in the button
isBlankBooleantrueOpen the "share on social networks" frame in a new window
modalWidthNumber500If the property "isBlank" is set to false, you can set the width of the modal window the "share on social networks"
modalHeightNumber500If the property "isBlank" is set to false, you can set the height of the modal window the "share on social networks"
customIconString''Custom image

Buttons for instant messengers

Facebook Messenger

OptionType'sDefaultDescription
appIDString''A unique identifier for the application
urlStringdocument.location.hrefURL-address you want to share
btnTextStringFacebookText to be written on your button
hasIconBooleantruePresence of social network icon in the button
customIconString''Custom image

Viber, WhatsApp

OptionType'sDefaultDescription
urlStringdocument.location.hrefURL-address you want to share
btnTextStringViber, WhatsAppText to be written on your button
hasIconBooleantruePresence of social network icon in the button
customIconString''Custom image

Telegram

OptionType'sDefaultDescription
urlStringdocument.location.hrefURL-address you want to share
descriptionStringdocument.titleMessages you want to share
btnTextStringTelegramText to be written on your button
hasIconBooleantruePresence of social network icon in the button
customIconString''Custom image

Send a message via email

This isn't really a share button, this is a button that allows you to open the software to send an email message, but it may be useful for you πŸ™ƒ

OptionType'sDefaultDescription
urlStringdocument.location.hrefURL-address you want to share
btnTextStringEmailText to be written on your button
hasIconBooleantruePresence of social network icon in the button
subjectStringdocument.titleEmail subject
customIconString''Custom image

Full list of social networks

  • Blogger
  • Digg
  • Email
  • Facebook
  • Facebook Messenger
  • Hatena
  • Instapaper
  • LinkedIn
  • LiveJournal
  • Odnoklassniki
  • Pinterest
  • Pocket
  • Reddit
  • Renren
  • Telegram
  • Tumblr
  • Twitter
  • Viber
  • Vkontakte
  • Weibo
  • WhatsApp
  • Xing

Not worked

  • Facebook counter
  • LinkedIn counter

Example

<twitter-button v-bind:isBlank="false" btnText />

Live Demo

<twitter-button class="share-button--circle" v-bind:hasIcon="false" />

Live Demo

<twitter-button v-bind:hasIcon="false" class="share-button--outline" />

Live Demo

<twitter-button class="share-button--circle share-button--outline" btnText />

Live Demo

<facebook-button class="share-button--outline" hasCounter />

Live Demo

<facebook-button
  class="share-button--painted"
  url="https://github.com/"
  hasCounter
/>

Live Demo

Author

This component was developed by Alexander Shulaev for personal purposes and submitted to Open Source, if it will help someone I will be very happy about it😊

Link

SVG-icon by Simple Icons

Roadmap

  • Implement a workflow with automatic version update and automatic publication of changes in npm via GitHub action

License

The MIT License (MIT)

1.1.1

2 years ago

1.1.0

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.0

5 years ago