Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Extend VList to support custom avatars with (some) VAvatar props #20846

Open
Drillan767 opened this issue Jan 7, 2025 · 0 comments

Comments

@Drillan767
Copy link

Problem to solve

In the current project I am working on, we rarely use VAvatar to display images, but to display a colored circle with some initials in it, for example a green circle with the letters "I" and "M" inside, to refer to a user's initial for example.
To do so, we use the following snippet:

<VAvatar
  color="green"
  text="IM"
/>

However, when trying to display a list of items, I am forced to do something like so:

<VList
  items="someItemsWithCusomAvatars"
>
  <template #prepend="{ item }">
    <VAvatar
      :text="item.text"
      :color="item.color"
    />
  </template>
</VList>

Proposed solution

Admittedly, I don't know how the internal code looks like, but I know that when using prependAvatar in a VList as an item's attribute, a VAvatar is rendered. So I think one way to make it work would be to be able to pass an avatar object to the VList's items props, with properties an Avatar needs, like follows:

const items = [
  {
    title: 'Item 1',
    subtitle: 'subtitle 1',
    avatar: {
      color: 'green-lighten-1',
      image: 'https://cdn.vuetifyjs.com/images/john-smirk.png',
      text: 'IM',
    }
  }
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant