0.0.12 • Published 10 months ago

avatar-vue3 v0.0.12

Weekly downloads
-
License
-
Repository
github
Last release
10 months ago

avatar-vue3

This component works as avatar creator just as you might have seen avatars in microsoft teams. It takes initials from full name and makes a display picture for that. This components consists of vue3, typescript and css It is useful when someone doesn't upload a picture in your web app, instead of showing the empty avatar there you can just pass there username or full name in the component and then it will create a picture with there name initials

  • Maximum component has been handled using props and is open source
  • It splits name by spaces and hyphens
  • Maximum length of avatar is 4 characters

Examples

  • Anees will become A
  • Anees Baig will become AB
  • Mirza Anees Baig will become MAB
  • Mirza Anees Baig Barlas will become MABB
  • Anees-Baig will become AB

Usage

npm install avatar-vue3

In file where you want to use the component add these imports

In script

import {Avatar} from  'avatar-vue3'
import 'avatar-vue3/style.css'

In template

<Avatar
    name="John Smith"
    :radius="10"
    :size="200"
    image="https://amymhaddad.s3.amazonaws.com/morocco-blue.png"
/>

or

<Avatar name="John Smith"/>

Props

PropertyTypeDefaultDecription
nameString-Name you want to make avatar for
sizeNumber48size of the avatar component, width and height are same in px
imageString-If you want to pass an image instead of a background color
colorString-Color of background, otherwise it will be a random color
fontSizeNumber-Size of font in px, otherwise it will be adjusted according to the size of avatar
radiusNumber50Border radius of the avatar component in px, validation value >= 0 && value <= 50
fontColorStringrgb(255, 255, 255)Font color of Avatar initials
blendBooleantrueBlend name colors with the background color for contrast
splitToNumber4The number of characters the name can split to

Playground

Go to https://mabbkhawaja.github.io/avatar-vue3/?path=/docs/avatar--docs for live examples

0.0.12

10 months ago

0.0.8

10 months ago

0.0.7

10 months ago

0.0.6

10 months ago

0.0.2

11 months ago

0.0.1

11 months ago