Components

Bubble

A chat bubble drawn like a person draws one: a single felt-tip stroke round a pillowy box, a solid fill (blue for what you send, gray or highlighter for the rest) and a tail on the sender's side. Also a folded note or a sticky note.

Install

terminal
npx shadcn@latest add @wobko/bubble

First time here? Add the registry to components.json first. How to install

Examples

Variants

Marker, highlighter, paper shade, a marker wash, paper and a line, red pencil hatching, and nothing at all. The tail sits on the sender's side.

A conversation

Bubbles inside Messages: the tail follows the sender, the earlier bubbles of a run lose theirs, a reaction chip sits on the edge, and the header and footer are hand notes.

Notes, stickies and your own hand

A bubble does not have to be a cloud. A note is a slip of paper folded twice, a sticky is a sticky note, and `pen="you"` writes in blue felt and the script font.

Bubbles as buttons

asChild turns a bubble into a real button: it wobbles on hover (drop-lines), draws a blue ring on keyboard focus, and can be pressed. Good for suggested replies.

API reference

Bubble

The row of one message body: aligns itself, carries the variant and the shape, and shares them with its content.

PropTypeDefaultDescription
variant"default" | "secondary" | "muted" | "tinted" | "outline" | "ghost" | "destructive""default"The ink: marker, highlighter, paper shade, a marker wash, paper and a line, nothing at all (prose), or red pencil hatching.
align"start" | "end""start" (or the enclosing Message)Which end of the row it sits on; the tail follows, and flips in right-to-left.
shape"cloud" | "note" | "sticky""cloud"A hand-drawn speech bubble, a folded slip of paper, or a sticky note (note and sticky are a Paper).
pen"ink" | "you""ink"`you` writes the outline in blue felt and the words in the script font: the person typing.
tailbooleantrueDraw the tail flick. Inside a BubbleGroup the earlier bubbles hide it by themselves.

BubbleContent

The body, and the element that is drawn. Text is real DOM text; the outline and fill are an aria-hidden svg behind it. `asChild` turns a bubble into a button or link (hover drop-lines, a drawn focus ring).

PropTypeDefaultDescription
asChildbooleanfalseRender the child element (a button or an anchor) as the bubble.
paperPartial<PaperProps>-For `note` and `sticky`: tape, fastener, curl, tilt or edge of the sheet.
seedstring | number-Pins the hand: the same seed always draws the same bubble.

BubbleReactions

A sticker chip that sits on the edge of a bubble: white vinyl, a cut line, a warm shadow. Put emoji, counts or small buttons inside.

PropTypeDefaultDescription
side"top" | "bottom""bottom"Which edge of the bubble it overlaps.
align"start" | "end""end"Which corner.

Accessibility

  • A bubble is a plain div (as upstream); the drawing is an aria-hidden svg with pointer-events none, so it never affects selection, find-in-page or screen readers.
  • Ink on the marker fill is 4.6:1 (the drawn fill is darker), on the highlighter and paper variants 8:1 or more. Muted text on paper is 8.9:1.
  • An interactive bubble is a real `button` or `a` through asChild; it gets the drawn focus ring on :focus-visible and the hover drop-lines, and keeps native keyboard behavior.
  • The tail follows the reading direction (it is on the right in right-to-left) and is a separate part, so it can be hidden without redrawing.
  • Density `calm` draws hairline pencil outlines with a flat wash (the tail included); forced colors replace the drawing with a real outline.
  • Difference from upstream: the body is drawn, so `bg-*`, `border-*` and `rounded-*` classes on `BubbleContent` (or `*:data-[slot=bubble-content]:bg-*` on `Bubble`) paint a plain CSS box behind the ink instead of restyling it. Choose the look with `variant`, `pen` and `shape`.

Source

The files the CLI copies into your project.

Loading the source