Make your AI a shadcn expert

Shadcn Bubble

React chat bubble for sent and received messages. Built with TypeScript and Tailwind CSS for Next.js using Base UI — seven variants, alignment, grouping, and reactions.

A bubble is the framed message. Color and side tell you who spoke; reactions hang off the edge. Use it for chat text, suggestion chips, and short errors. Avatars, names, and timestamps belong on Message.

Scroll to load preview...

Usage

import { Bubble, BubbleContent, BubbleReactions } from "@/components/ui/bubble"
<Bubble>
  <BubbleContent>
    I checked the registry output and removed the stale route.
  </BubbleContent>
  <BubbleReactions>
    <span>👍</span>
  </BubbleReactions>
</Bubble>

variant paints the surface. align="end" sends it to the right.

Composition

BubbleContent
BubbleReactions

BubbleGroup stacks consecutive bubbles from the same sender. Put align on each Bubble, not the group.

Variants

default is you. secondary, muted, tinted, and outline are them. ghost is unframed assistant text — it also drops the 80% max-width. destructive is a failed action.

Scroll to load preview...

Alignment

start is received. end is sent. In a full chat row, set alignment on Message instead.

Scroll to load preview...

Bubble Group

Wrap consecutive bubbles from the same person. Spacing stays tight; align still lives on each Bubble.

Scroll to load preview...

render={<button />} on BubbleContent turns the surface into a real control. Use it for suggestion chips.

Scroll to load preview...

Reactions

BubbleReactions anchors to an edge. side is top or bottom, align is start or end. They overlap the bubble, so leave extra gap between rows.

Scroll to load preview...

Show More / Collapsible

Long text composes with Collapsible. The trigger is a “Show more” link inside BubbleContent.

Scroll to load preview...

Tooltip

Wrap a bubble in a Tooltip to show when it was read.

Scroll to load preview...

Popover

Pair a destructive bubble with a Popover when the full error should wait for a click.

Scroll to load preview...

Markdown

Render assistant text through Markdown (Streamdown). Keep user bubbles as plain text.

Scroll to load preview...

API

Prop

Type

BubbleContent

Prop

Type

BubbleReactions

Prop

Type

Bubble, BubbleContent, BubbleReactions, and BubbleGroup take className.

Notes

Reactions sit on the edge

They overlap the bubble by design. Leave extra gap between rows. Group the row with role="img" and an aria-label so it announces once, not as “thumbs up fire plus eight”.

Color is not the error. Put the reason in the destructive text.

With other components

Questions

Was this page helpful?

Sign in to leave feedback.