Avatar

Avatar

Default

Documentation Vuesax Alpha

These docs refer to the Vue 3 support, to see the documents of the previous versions you can do it here 👉 Vuesax (4.0+)

Add an avatar easily and with functionality with the component <vs-avatar>

L
EY
Code Copied

Color

Change the color of the compound with the color property, the colors allowed are the main colors of vuesax and (HEX, RGB)

P
S
D
W
D
HEX
RGB
Code Copied

Size

Change the size of the component to the number provided if for example the size value is 60 equivalent to 60px in height and width

L
EY
Code Copied

Badge

Add a badge to the component with the badge property or the slot

You can also change the color to represent a user status as disconnected or connected with colors such as success or danger, this you do with the badge-color property

There are times when you need to use the avatar in a chat environment and for this you can add the writing property that adds a writing animation

28
Off
Code Copied

Auto font and split

If the user has a short name, it is added as it is but if it is a very long text or has several spaces, the text to be displayed will be automatically generated so that it can be seen correctly

The maximum length of characters is 5. When that limit is exceeded, changes are made in the text

L
J
F
SW
DRB
GREH
Code Copied

Shape

Circle

Change the border-radius of the entire component to 50% with the circle property making it fully circular

J
F
Code Copied

Square

Change the border-radius of the entire component to 0% with the square property making it completely square

J
F
Code Copied

History

It generates a border around the avatar, this is usually used to represent that the user is doing an action or in many cases has a History

You can make the border a gradient like instagram with the property history-gradient

Code Copied

Icon

You can put an icon inside an avatar when for example an image is not yet added or is a new user, for this you can simply use the default slot

Code Copied

Loading

Add a loading animation to the component, this property is a boolean so you can add it without any value

28
Code Copied

Icons

Add a space next to the avatar with the slot icons where you can put icons for some dynamic action of that user in specific

Code Copied

Group

You can group several avatar with the parent component vs-avatar-group, this component has two interesting properties:

  • max: determine the maximum number of avatars to show and the rest hides it generating the number in the last avatar shown

  • float: causes the avatar components to be placed on each other and the grouping of one on top of the other is eliminated

Code Copied

API

PROPS

PropertyTypeValuesDescriptiondefaultExample More
colorStringVuesax Colors RGB HEXcolor of the component.--vs-gray-2 Usage
sizeNumberNumbersize of the avatar component.44 Usage
badgeBooleantrue falseDetermine if the badge is active.false Usage
badge-colorStringVuesax colorsRGBHEXChange the color of the badge inside the avatar.primary Usage
shapeStringsquare circleChange the style of the avatar by circulating it.false Usage
writingBooleantruefalseAdd an animation to the writing badge.false Usage
historyBooleantruefalseAdd a border to the avatar.gray-2 Usage
history-gradientBooleantruefalseChange the color of the border to a gradient.false Usage
loadingBooleantruefalseAdd a loading animation to the avatar.false Usage
maxnumbernumber(vs-avatar-group) determine how many avatars are visible. Usage
floatBooleantruefalse(vs-avatar-group) change the way the avatar is composed by placing one next to the other.false Usage Open Close
null'
pointerBooleantruefalseDetermine if the avatar has a pointer cursor.false

SLOTS

PropertyTypeValuesDescriptiondefaultExample More
textslotAdd text within the avatar component. Usage Open Close
<vs-avatar>
  <template #text>
    Lily
  </template>
</vs-avatar>
badgeslotAdd to the badge everything that is inside the slot, commonly used for numbers and an icon. Usage Open Close
<vs-avatar badge badge-color="success">
  <img src="/avatars/avatar-2.png" alt="">
  <template #badge>
    28
  </template>
</vs-avatar>
iconsslotAdd a space to put icons next to the avatar. Usage Open Close
<vs-avatar>
  <img src="/avatars/avatar-1.png" alt="">
  <template #icons>
    <i class='bx bxl-facebook-square' ></i>
    <i class='bx bxl-github' ></i>
    <i class='bx bxl-twitter' ></i>
  </template>
</vs-avatar>
Last Updated: 2024-06-13, 16:08:34