# Guide

# Instalation

npm install @amaury-tobias/v-avatar

# Usage

v-avatar is a UMD module, so it can be used in both a Vue and Nuxt instance as well as in a non-modular environment where vAvatar will be registered as a global variable.

# Vue

# As Vue component



 




 








<template>
  ...
  <v-avatar username='John Doe'>
  ...
</template>

<script>
  import { vAvatar } from '@amaury-tobias/v-avatar'

  export default {
    components: {
      vAvatar
    }
  }
</script>

# Vue global component

import Vue from 'vue'
import vAvatar from '@amaury-tobias/v-avatar'

Vue.use(vAvatar)

The component is now registered globally

# Nuxt

./plugins/vAvatar.js

import Vue from 'vue'
import vAvatar from '@amaury-tobias/v-avatar'

Vue.use(vAvatar)

`nuxt.config.js``



 



module.exports = {
  ...
  plugins: ['~/plugins/vAvatar.js']
  ...
}

pages/**/*.vue

<v-avatar username="John Doe" />

# Browser

The component autoinstall in browser enviroment

<!DOCTYPE html>
<html>
  <head>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script src="https://unpkg.com/@amaury-tobias/v-avatar"></script>
  </head>
  <body>
    <div id="app">
      <v-avatar username="Jon Doe"></v-avatar>
    </div>
    <script>
      var app = new Vue({
        el: '#app'
      })
    </script>
  </body>
</html>

# Properties

Name Required Type Default
username String 'V-A'
initials String -
inline Boolean false
src String -
:customStyle Object -
backgroundColor String -
color String -
:lighten Number 80
:size Number 50
:rounded Boolean false

# Build Setup

# install dependencies
npm install

# serve whith hot reload al localhost:8080
npm run serve

# build
npm run build

# Unit testing

# Test with mocha y chai
npm test