Custom content
The content slot replaces what the badge shows, for example an icon.
Whether the badge renders is still decided by the content property, so it must be set to a non-empty value when the slot is used. Provide an accessible name through label in that case.
<script setup lang="ts">
import { Bookmark, Check } from '@lucide/vue'
import { Badge, IconButton } from '@hina-ui/vue'
</script>
<template>
<Badge content="Done" tone="success" size="md" label="Done">
<template #content>
<Check class="size-3" />
</template>
<IconButton label="Bookmark" variant="soft">
<Bookmark />
</IconButton>
</Badge>
</template>
With bare set the badge draws no background or padding and only positions and outlines its content, which decides the size. Put an Indicator in the slot to show a status dot on the corner of an avatar.
<script setup lang="ts">
import { Avatar, Badge, Indicator, Inline } from '@hina-ui/vue'
</script>
<template>
<Inline gap="lg">
<Badge content="online" bare label="Online" placement="bottom-end" shape="circle">
<template #content>
<Indicator tone="success" size="lg" />
</template>
<Avatar src="/avatars/paper.webp" alt="Hoshimi Shion" />
</Badge>
<Badge content="away" bare label="Away" placement="bottom-end" shape="circle">
<template #content>
<Indicator tone="warning" size="lg" />
</template>
<Avatar name="Hoshimi Shion" />
</Badge>
</Inline>
</template>