Skip to content

feat(VAvatar): add badge prop + dot-size for VBadge#22496

Merged
J-Sek merged 5 commits intonextfrom
feat/avatar-badge
Feb 10, 2026
Merged

feat(VAvatar): add badge prop + dot-size for VBadge#22496
J-Sek merged 5 commits intonextfrom
feat/avatar-badge

Conversation

@J-Sek
Copy link
Copy Markdown
Contributor

@J-Sek J-Sek commented Jan 5, 2026

Description

badge prop aims to make it significantly easier to add color dots to the avatar

  • defaults to color dot when used as string
  • calculates dot size based on avatar size
  • calculates offset to adjust the badge placement (expecting floating when avatar is not a circle)
image

Markup:

<template>
  <v-app theme="dark">
    <v-container class="pa-6 pa-md-12 bg-surface">
      <v-row align="end" class="ga-6 ga-md-16" justify="center">
        <v-avatar :image="users[0].avatarUrl" badge="red" size="x-small" />
        <v-avatar :image="users[1].avatarUrl" badge="red" size="small" />
        <v-avatar :image="users[2].avatarUrl" badge="red" size="default" />
        <v-avatar :image="users[3].avatarUrl" badge="red" size="large" />
        <v-avatar :image="users[4].avatarUrl" badge="red" size="x-large" />
      </v-row>

      <v-row align="end" class="ga-6 ga-md-16 mt-12" justify="center">
        <v-avatar
          :badge="{ color: 'red', location: 'bottom end', floating: true }"
          :image="users[0].avatarUrl"
          rounded="lg"
          size="x-small"
        />
        <v-avatar
          :badge="{ color: 'red', location: 'bottom end', floating: true }"
          :image="users[1].avatarUrl"
          rounded="lg"
          size="small"
        />
        <v-avatar
          :badge="{ color: 'red', location: 'bottom end', floating: true }"
          :image="users[2].avatarUrl"
          rounded="lg"
          size="default"
        />
        <v-avatar
          :badge="{ color: 'red', location: 'bottom end', floating: true }"
          :image="users[3].avatarUrl"
          rounded="lg"
          size="large"
        />
        <v-avatar
          :badge="{ color: 'red', location: 'bottom end', floating: true }"
          :image="users[4].avatarUrl"
          rounded="lg"
          size="x-large"
        />
      </v-row>

      <v-row align="end" class="ga-6 ga-md-16 mt-12" justify="center">
        <v-avatar
          :badge="{ color: 'success', location: 'bottom end', floating: true }"
          :image="users[0].avatarUrl"
          rounded="lg"
          size="x-small"
        >
          <template #badge>
            <v-icon icon="$complete" />
          </template>
        </v-avatar>
        <v-avatar
          :badge="{ color: 'success', location: 'bottom end', floating: true }"
          :image="users[1].avatarUrl"
          rounded="lg"
          size="small"
        >
          <template #badge>
            <v-icon icon="$complete" />
          </template>
        </v-avatar>
        <v-avatar
          :badge="{ color: 'success', location: 'bottom end', floating: true }"
          :image="users[2].avatarUrl"
          rounded="lg"
          size="default"
        >
          <template #badge>
            <v-icon icon="$complete" />
          </template>
        </v-avatar>
        <v-avatar
          :badge="{ color: 'success', location: 'bottom end', floating: true }"
          :image="users[3].avatarUrl"
          rounded="lg"
          size="large"
        >
          <template #badge>
            <v-icon icon="$complete" />
          </template>
        </v-avatar>
        <v-avatar
          :badge="{ color: 'success', location: 'bottom end', floating: true }"
          :image="users[4].avatarUrl"
          rounded="lg"
          size="x-large"
        >
          <template #badge>
            <v-icon icon="$complete" />
          </template>
        </v-avatar>
      </v-row>
    </v-container>
  </v-app>
</template>

<script setup>
  const users = Array.from({ length: 5 })
    .map((_, i) => ({ id: i, avatarUrl: `https://vuetifyjs.b-cdn.net/docs/images/one/snips/avatars/${2 + i}.jpg` }))
</script>

@J-Sek J-Sek self-assigned this Jan 5, 2026
@J-Sek J-Sek force-pushed the feat/avatar-badge branch from 875e684 to cf50b39 Compare February 10, 2026 15:17
@J-Sek J-Sek merged commit cc9f417 into next Feb 10, 2026
16 checks passed
@J-Sek J-Sek deleted the feat/avatar-badge branch February 10, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant