vue-avatar

Avatar component for Vue.js
466,478 612
Install
npm install vue-avatar
Latest Version:2.3.3
Vue:2
Older releases:1
License:MIT
Last Updated:Dec 7, 2022
Links: GitHub  ·  npm
Maintainer: eliep

vue-avatar

Build Status

An avatar component for vue.js.

This component display an avatar image and if none is provided fallback to the user initials. This component is highly inspired from react-user-avatar.

Rules used to compute user initials:

  • divide the username on space and hyphen
  • use the first letter of each parts
  • never use more than three letters as initials
  • if the username is divided in more than three parts and has part starting with an uppercase, skip parts starting with a lowercase.

You can find a few examples and the documentation here

Installation

npm install vue-avatar

Version

Vuejs version vue-avatar version
^1.0.18 ^1.3.0
^2.0.0 ^2.0.0

Usage

vue-avatar is a UMD module, which can be used as a module in both CommonJS and AMD modular environments. When in non-modular environment, Avatar will be registered as a global variable.

ES6


import Avatar from 'vue-avatar'

export default {
  ...
  components: {
    Avatar
  },
  ...
}

After that, you can use it in your templates:

<avatar username="Jane Doe"></avatar>

CommonJS

var Vue = require('vue')
var Avatar = require('vue-avatar')

var YourComponent = Vue.extend({
  ...
  components: {
    'avatar': Avatar.Avatar
  },
  ...
})

Browser

<script src="path/to/vue/vue.min.js"></script>
<script src="path/to/vue-avatar/dist/vue-avatar.min.js"></script>

new Vue({
  ...
  components: {
    'avatar': VueAvatar.Avatar
  },
  ...
})

Props

Event

Build Setup

# install dependencies
npm install

# serve gh pages with hot reload at localhost:8080/gh-pages/index.html
npm run dev

# build
npm run bundle

Test

npm test

License

Released under the MIT License.

Related Packages

@alexrafael10/vue-avatar

Avatar component for Vue.js

6,112 2
@amaury-tobias/v-avatar

Componente de avatar basado en Vue.js

16,378 1
vue-avatar-3

A useful avatar component for Vue 3, with support for letter avatars.

7,661 1
vue-nice-avatar

Dummy avatar generator

539 106
vue-acl

Plugin of Access Control List from Vue JS 2

89,002 371

Version History

Version Released License
2.3.3 MIT
2.3.2 MIT
2.3.1 MIT
2.3.0 MIT
2.2.0 MIT