--- title: Bubble description: Displays conversational content in a message bubble. Supports variants, alignment, grouping, reactions, and collapsible content. base: aria component: true --- The `Bubble` component displays framed conversational content. Use it for chat text, short structured output, quoted replies, suggestions, and reactions. For full-featured chat interfaces, use the [`Message`](/docs/components/aria/message) component. `Bubble` is intentionally scoped to the bubble surface. Place avatars, names, timestamps, metadata, and message-level actions in [`Message`](/docs/components/aria/message). ## Installation Command Manual ```bash npx shadcn@latest add bubble ``` Copy and paste the following code into your project. Update the import paths to match your project setup. ## Usage ```tsx showLineNumbers import { Bubble, BubbleContent, BubbleReactions } from "@/components/ui/bubble" ``` ```tsx showLineNumbers I checked the registry output and removed the stale route. 👍 ``` ## Composition Use the following composition to build a bubble: ```text Bubble ├── BubbleContent └── BubbleReactions ``` Use `BubbleGroup` to group consecutive bubbles from the same sender: ```text BubbleGroup ├── Bubble │ └── BubbleContent └── Bubble └── BubbleContent ``` ## Features - Seven visual variants, from a strong primary bubble to unframed ghost content - Start and end alignment for sender and receiver bubbles - Reactions that anchor to the bubble edge with configurable side and alignment - Bubbles size to their content, up to 80% of the container width - Polymorphic content via `render` for link and button bubbles - Customizable styling through the `className` prop on every part ## Variants Use `variant` to change the visual treatment of the bubble. | Variant | Description | | ------------- | ------------------------------------------------------ | | `default` | A strong primary bubble, usually for the current user. | | `secondary` | The standard neutral bubble for conversation content. | | `muted` | A lower-emphasis bubble for quiet supporting content. | | `tinted` | A subtle primary-tinted bubble. | | `outline` | A bordered bubble for secondary or rich content. | | `ghost` | Unframed content for assistant text or rich content. | | `destructive` | A destructive bubble for error or failed actions. | A bubble sizes to its content, up to 80% of the container width. The `ghost` variant removes the max-width so assistant text and rich content can span the full row. ## Alignment Use `align` on `Bubble` to align the bubble to the start or end of the conversation. | align | Description | | ------- | -------------------------------------------------- | | `start` | Align the bubble to the start of the conversation. | | `end` | Align the bubble to the end of the conversation. | **Note:** When building chat interfaces, you probably want to use alignment on the `Message` component itself, not the `Bubble` component. You can use the `role` prop on the `Message` component to automatically align the bubble to the start or end of the conversation. ## Bubble Group Use `BubbleGroup` to group consecutive bubbles from the same sender. Note the `align` prop should be set on the `Bubble` component itself, not the `BubbleGroup` component. ```text BubbleGroup ├── Bubble │ └── BubbleContent └── Bubble └── BubbleContent ``` ## Links and Buttons You can turn a bubble into a link or button by using the `render` prop on `BubbleContent`. ```tsx showLineNumbers import { Bubble, BubbleContent } from "@/components/ui/bubble" export function BubbleLinkDemo() { return ( ``` ### Interactive Bubbles When a bubble is clickable, render it as a real `