Every example is a complete Vue file. Copy it into an app that has the registry installed.
Variants
Secondary for others, default for you, muted for system notes, tinted for a pinned note, outline for quoted content, destructive for a message that failed to send.
BubbleVariants.vue
<script setup lang="ts">
import { Bubble, BubbleContent } from '@/components/ui/bubble'
</script>
<template>
<div class="flex w-full max-w-120 flex-col gap-(--bh-space-150)">
<Bubble variant="secondary">
<BubbleContent>Is the price list for wholesale customers in the CRM yet?</BubbleContent>
</Bubble>
<Bubble align="end">
<BubbleContent>Yes, since this morning. It applies to orders placed from today.</BubbleContent>
</Bubble>
<Bubble variant="muted">
<BubbleContent>Minh joined the conversation.</BubbleContent>
</Bubble>
<Bubble variant="tinted">
<BubbleContent>Pinned: the ERP is down for maintenance on Sunday, 01:00 to 03:00.</BubbleContent>
</Bubble>
<Bubble variant="outline">
<BubbleContent>Quoted from order 10482: two items, paid by bank transfer.</BubbleContent>
</Bubble>
<Bubble variant="destructive" align="end">
<BubbleContent>Not sent. Check your connection and try again.</BubbleContent>
</Bubble>
</div>
</template>Suggested replies
BubbleContent as="button" turns a bubble into a reply people can pick. It takes the outline hover and the focus ring. Tab to one and press Enter.
BubbleSuggestions.vue
<script setup lang="ts">
import { ref } from 'vue'
import { Bubble, BubbleContent, BubbleGroup } from '@/components/ui/bubble'
const replies = ['Retry now', 'Retry at the next sync', 'Show the error']
const sent = ref<string | null>(null)
</script>
<template>
<div class="flex w-full max-w-120 flex-col gap-(--bh-space-150)">
<Bubble variant="secondary">
<BubbleContent>Order 10482 failed to reach the ERP. What would you like to do?</BubbleContent>
</Bubble>
<Bubble v-if="sent" align="end">
<BubbleContent>{{ sent }}</BubbleContent>
</Bubble>
<BubbleGroup v-else role="group" class="items-end" aria-label="Suggested replies">
<Bubble v-for="reply in replies" :key="reply" variant="outline">
<BubbleContent as="button" type="button" @click="sent = reply">{{ reply }}</BubbleContent>
</Bubble>
</BubbleGroup>
</div>
</template>Reactions
BubbleReactions hangs over the bubble’s edge. Put a button inside to let people react; give it a name that says what pressing it does.
BubbleWithReactions.vue
<script setup lang="ts">
import { ref } from 'vue'
import { Bubble, BubbleContent, BubbleReactions } from '@/components/ui/bubble'
const liked = ref(true)
</script>
<template>
<div class="flex w-full max-w-120 flex-col gap-(--bh-space-400) pb-(--bh-space-200)">
<Bubble variant="secondary">
<BubbleContent>All 240 products are now in the online store.</BubbleContent>
<BubbleReactions>
<span aria-hidden="true">🎉 2</span><span class="sr-only">2 party reactions</span>
</BubbleReactions>
</Bubble>
<Bubble align="end">
<BubbleContent>Great, thank you. I will tell the sales team.</BubbleContent>
<BubbleReactions align="start">
<button
type="button"
class="flex cursor-pointer items-center gap-(--bh-space-050) rounded-(--bh-radius-pill) px-(--bh-space-075) py-(--bh-space-025) outline-none hover:bg-(--bh-color-background-neutral-hover) focus-visible:outline-solid focus-visible:outline-(length:--bh-border-width-focused) focus-visible:outline-(color:--bh-color-border-focus) focus-visible:outline-offset-(--bh-state-focus-offset)"
:aria-pressed="liked"
:aria-label="liked ? 'Remove your thumbs up' : 'Add a thumbs up'"
@click="liked = !liked"
>
<span aria-hidden="true">👍</span><span>{{ liked ? 1 : 0 }}</span>
</button>
</BubbleReactions>
</Bubble>
</div>
</template>