Giter Site home page Giter Site logo

thisdotname / vue-share-it Goto Github PK

View Code? Open in Web Editor NEW
23.0 3.0 10.0 2.55 MB

A Vue.js component for sharing links to social networks

Home Page: https://thisdotname.github.io/vue-share-it/

License: MIT License

Vue 87.71% JavaScript 12.29%
vue-component vuejs social-buttons

vue-share-it's Introduction

Release Vue.js License

vue-share-it

A highly customizable Vue.js component for sharing links on social networks.

Features

  • Easy install
  • Highly customizable
  • Extensive documentation & examples
  • Developer support
  • SEO friendly

Examples

Live demo

Docs

Installation

# Yarn 
yarn add vue-share-it

# NPM 
npm install vue-share-it --save

Usage

Browserify / Webpack

import shareIt from 'vue-share-it';

Vue.use(shareIt);

HTML

<script src="https://unpkg.com/[email protected]/dist/vue-share-it.js"></script>

Supported social-media platforms

Platform Value
Twitter twitter
LinkedIn linkedin
Facebook facebook
Whatsapp whatsapp
Reddit reddit

API

Props

Prop Data type Default Description
text String '' Caption
url String '' URL to share
width Number 600 Width of the share window
height Number 600 Height of the share window
dense Boolean false Dense button styling
dark Boolean false Dark button styling
targets Array [] Specify social media targets, defaults to all available targets
icons Boolean false Use icons as buttons
outline Boolean false Outline button styling
round Boolean false Round button styling for icons
iconSize String lg Specify icon size. See size chart below
shareConfig Object {
linkedin: {},
twitter: {},
facebook: {},
whatsapp: {},
reddit: {},
}
Advanced configuration for target specific styling

Events

Name Description Value
clicked Event that is emitted when a share button is clicked Returns social media platform which was clicked. E.g. ["twitter"]

Slots

Name Description
${platform}-icon Custom icon for platform
${platform}-label Custom label for platform

Examples

Using vue-share-it component

Default

<share-it />

Global configs

<share-it text="This is sample text" url="https://www.google.com" :height="600" :width="600" />

Targets

<share-it :targets="['twitter', 'facebook']" />

Dark

<share-it dark />

Dense

<share-it dense />

Outlined

<share-it outline />

Button configs

const share = {
  twitter: {
    size: "2x",
    label: "Custom label!",
    round: true,
  },
  linkedin: {
    size: "2x",
    color: "#333",
    backgroundColor: "yellow",
  },
  facebook: {
    size: "3x",
    dark: true
  },
  whatsapp: {
    size: "2x",
    dense: true,
    outline: true,
    color: 'green',
  },
}
<share-it :shareConfig="share" />

Icons

<share-it icons />

Outlined icons

<share-it icons outline />

Rounded icons

<share-it icons outline round />

Icon configs

const iconConfig ={
  twitter: {
    icon: true,
    size: "sm",
    color: "#333",
    round: true,
    backgroundColor: 'yellow'
  },
  linkedin: {
    icon: true,
    size: "lg",
    outline: true,
    round: true,
    
  },
  facebook: {
    icon: true,
    size: "2x",
    outline: true,
    round: true
  },
  whatsapp: {
    icon: true,
    size: "3x",
    outline: true,
    round: true
  },
  reddit: {
    icon: true,
    size: "4x",
    outline: true,
    round: true
  },
}
<share-it :shareConfig="iconConfig" />

Using slots

<share-it>
  <template v-slot:twitter-icon>
    <v-icon>mdi-twitter</v-icon>
  </template>
  <template v-slot:twitter-label>
    <em>Tweet it!</em>
  </template>
  <template v-slot:whatsapp-icon>
    <v-icon>mdi-whatsapp</v-icon>
  </template>
  <template v-slot:whatsapp-label>
    <em>Share on Whatsapp</em>
  </template>
</share-it>

Size chart

Code Size
xs .75em
sm .875em
lg 1.33em
2x 2em
3x 3em
4x 4em
5x 5em
6x 6em
7x 7em
8x 8em
9x 9em
10x 10em

vue-share-it's People

Contributors

dependabot[bot] avatar thisdotname avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vue-share-it's Issues

about:blank tab opens up in addition to pop-up for the social share

Hi there - great library.

One issue (tested in both Edge and Chrome) is that when user clicks one of the share links, in addition to the expected pop-up for the social site, an empty "about:blank" tab also opens up. Is there a way around this?

Using this in a gridsome project.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.