# Bubble

Displays conversational content in a message bubble. Supports variants, alignment, grouping, reactions, and collapsible content.

Section: Blocks / Chat
Page: https://ui.heyramzi.com/components/bubble
Import path: `@heyramzi/ui/shadcn/bubble`

## Import

```ts
import * as Bubble from "@heyramzi/ui/shadcn/bubble";
```

## Usage

```svelte
<Bubble.Root align="end">
  <Bubble.Content>Hey there! What's up?</Bubble.Content>
</Bubble.Root>
<Bubble.Group>
  <Bubble.Root variant="muted">
    <Bubble.Content>Hey! Want to see chat bubbles?</Bubble.Content>
  </Bubble.Root>
  <Bubble.Root variant="muted">
    <Bubble.Content>I can group messages and switch sides.</Bubble.Content>
    <Bubble.Reactions role="img" aria-label="2 reactions">
      <span>+2</span>
    </Bubble.Reactions>
  </Bubble.Root>
</Bubble.Group>
```

## Demo

```svelte
<script lang="ts">
	import * as Bubble from "@heyramzi/ui/shadcn/bubble";
</script>

<div class="flex w-full max-w-sm flex-col gap-8 py-12">
	<Bubble.Root align="end">
		<Bubble.Content>Hey there! what's up?</Bubble.Content>
	</Bubble.Root>
	<Bubble.Group>
		<Bubble.Root variant="muted">
			<Bubble.Content>Hey! Want to see chat bubbles?</Bubble.Content>
		</Bubble.Root>
		<Bubble.Root variant="muted">
			<Bubble.Content>
				I can group messages, switch sides, and keep the whole thread easy to scan.
			</Bubble.Content>
			<Bubble.Reactions role="img" aria-label="Reaction: thumbs up">
				<span>👍</span>
			</Bubble.Reactions>
		</Bubble.Root>
	</Bubble.Group>
	<Bubble.Root align="end">
		<Bubble.Content>Sure. Hit me with your best demo.</Bubble.Content>
	</Bubble.Root>
	<Bubble.Root variant="muted">
		<Bubble.Content>
			Yes. You are reading a demo that is demoing itself. Very meta. Very on-brand.
		</Bubble.Content>
		<Bubble.Reactions role="img" aria-label="Reactions: thumbs up, fire, eyes, and 2 more">
			<span>👍</span>
			<span>🔥</span>
			<span>👀</span>
			<span>+2</span>
		</Bubble.Reactions>
	</Bubble.Root>
</div>
```

## API

### Bubble.Root

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `variant` | `"default"` \| `"secondary"` \| `"muted"` \| `"tinted"` \| `"outline"` \| `"ghost"` \| `"destructive"` | `"default"` |  |
| `align` | `"start" \| "end"` | `"start"` |  |
| `ref` | `HTMLDivElement \| null` | `null` | bindable |
| `class` | `string` |  |  |
| `children` | `Snippet` |  |  |

Every prop of `HTMLAttributes<HTMLDivElement>` from `svelte/elements`.

### Bubble.Content

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `child` | `Snippet<[{ props: Record<string, unknown> }]>` |  |  |
| `ref` | `HTMLDivElement \| null` | `null` | bindable |
| `class` | `string` |  |  |

Every prop of `HTMLAttributes<HTMLDivElement>` from `svelte/elements`.

### Bubble.Group

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ref` | `HTMLDivElement \| null` | `null` | bindable |
| `class` | `string` |  |  |
| `children` | `Snippet` |  |  |

Every prop of `HTMLAttributes<HTMLDivElement>` from `svelte/elements`.

### Bubble.Reactions

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `side` | `"top"` \| `"bottom"` | `"bottom"` |  |
| `align` | `"start"` \| `"end"` | `"end"` |  |
| `ref` | `HTMLDivElement \| null` | `null` | bindable |
| `class` | `string` |  |  |
| `children` | `Snippet` |  |  |

Every prop of `HTMLAttributes<HTMLDivElement>` from `svelte/elements`.
