0.3.2 • Published 5 years ago

@luanedcosta/vue-profile-picture v0.3.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

Vue Profile Picture

Lightweight vue component to render the user picture or his name initials It's easy to customize with your style and change the behavior using the properties of the component.

Instalation

To install the package in your project you can type:

Once installed you can use the component as a plugin:

There's no options, so you can ignore the second parameter of Vue.use()

import VueProfilePicture from '@luanedcosta/vue-profile-picture'

Vue.use(VueProfilePicture)

Or you can import the component locally:

import { VueProfilePicture } from '@luanedcosta/vue-profile-picture'

export default {
    components: { VueProfilePicture }
}

Simple Usage

If exists an image the component will render a <img> tag. If the user doesn't have an image his initials will appear in place of the image.

<vue-profile-picture name="Username" img="Image src"/>

Props

The table below contains all component props.

PropertyTypeDefaultRequiredExplanation
nameStringtrueName of the user
classesStringnullfalseHTML class property for the <img> tag or <div> with the initials
stylesObjectnullfalseHTML style property for the <img> tag or <div> with the initials
noStyleBooleanfalsefalseRemove all default component classes to allow you to define your own css classes
numOfInitialsNumber2falseNumber of letters that will appear with the user doesn't have image
nameSeparatorStringwhite spacefalseCharacter or string that separates each user name
transformNumber1false1 = Initials uppercase; 2 = Initials lowercase; 0 = Don't transform the text
firstNameBooleanfalsefalseThe component will show only the firstname initials
lastNameBooleanfalsefalseThe component will show only the lastname initials
defString'-'falseIf the component didn't find an image neither the user name the component will display this property value on screen
imgStringnullfalseThe src for the image. The same as the src property of the <img> tag
altStringnullfalseThe same as alt property of the <img> tag
draggableString"true"falseIf true the image can be draggable