Skip to content
Cojeev UI

Bubble

Conversation

Groups conversational content and timestamps into visually distinct message bubbles.

React · copy into your project · light and dark themes

Try it

Loading preview…

Take it with you

Copy the example, API and usage notes for your editor or AI assistant.

Add to your project

Terminal
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/bubble.json

The command includes the component’s shared dependencies. Your project keeps editable source files.

Include the complete example

This example also composes button, presence. Install its parts together:

Terminal
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/button.json https://luv-jeri.github.io/cojeev-ui/r/bubble.json https://luv-jeri.github.io/cojeev-ui/r/presence.json

Using bubble

  • Compose BubbleRow, BubbleContent, and BubbleTime to present a message and its timing.

  • Use the available bubble variants to distinguish message presentation while keeping sender information in the content.

  • BubbleReaction composes Button for an explicitly labelled, controlled reaction; pass aria-label and aria-pressed with your count. BubbleTyping supplies a labelled, controlled typing indicator that becomes still under quiet preferences.

  • The conversation surface, timestamps and speech-tail cutout use theme-aware surface/text roles in both modes. Set --bubble-surface when providing a custom surrounding surface.

API

Compose the exported parts below. The prop types are read from the React source during the registry build.

Native element or underlying primitive props are inherited where declared, including accessible labels, event handlers and refs.

BubbleProps

PropTypeRequired
variant"default" | null | undefinedNo
size"default" | null | undefinedNo
asReact.ElementTypeNo

BubbleRowProps

PropTypeRequired
variant"default" | "me" | null | undefinedNo
size"default" | null | undefinedNo
asReact.ElementTypeNo

BubbleContentProps

PropTypeRequired
variant"default" | "me" | "tail" | null | undefinedNo
size"default" | null | undefinedNo
asReact.ElementTypeNo

BubbleGapProps

PropTypeRequired
variant"default" | null | undefinedNo
size"default" | null | undefinedNo
asReact.ElementTypeNo

BubbleTimeProps

PropTypeRequired
variant"default" | null | undefinedNo
size"default" | null | undefinedNo
asReact.ElementTypeNo

BubbleReactionProps

PropTypeRequired
aria-label

Defines a string value that labels the current element.

string | undefinedYes

BubbleTypingProps

PropTypeRequired
labelstringNo

Accessibility

  • Keep messages in a meaningful reading order and include sender and time text when needed; bubble styling does not create a live region.

States and appearance

rest

For conditional content, keep a MotionPresence boundary around keyed MotionSurface children. The shared entrance and exit states work with native primitives and respect your motion preference.

Try pointer and keyboard interaction, and switch the appearance control in the navigation to compare light and dark mode. Motion respects reduced motion preferences.