v-svg

Simple SVG component
921 1
Install
npm install v-svg
Latest Version:1.0.0
Vue:2
Last Updated:Oct 23, 2016
Links: GitHub  ·  npm
Maintainer: phunky

v-svg

VueJS 2 component for making SVG sprites simpler to use.

Setup

import svg from 'vue-svg-directive'
// ...
Vue.use(svg, {
  filepath: '/static/sprites.svg', // Optional filepath to your svg sprite
  prefix: 'icon-',  // Optional prefix for all your sprite names
  class: 'icon', // Optional class that will be applied to the <svg> element (optional)
  size: '32' // Optional default size value
});

Usage

<v-svg sprite="home"></div>

The size attribute gives you the ability to change the viewBox value.

<!--// viewBox="0 0 32 32 "//-->
<svg v-svg sprite="home" size="32"></svg>
<!--// viewBox="0 0 32 64 "//-->
<svg v-svg sprite="home" size="32 64"></svg>
<!--// viewBox="5 5 32 64 "//-->
<svg v-svg sprite="home" size="5 5 32 64"></svg>

Related Packages

vue-svg-pan-zoom

Vue component for svg-pan-zoom

59,567
@jt-icons/icon-vue-components

Vue components of JT Icons collection.

2,961 1
@svgv/core

Node.js API to transform SVGs into Vue components.

1,525 4
@k-l-lambda/web-widgets

A package contains some utility vue.js components and modules.

831 0
svg-to-vue

Utility to convert SVG code into Vue component definition

2,667,077 31

Version History

Version Released Vue License
1.0.0 ^2.0.1