Rendyn

Component library

189 components

Agent UI

Message Bubble

Message Bubble supplies a visual surface and optional collapsible content within a message row.

React Tailwind CSS

Practical React example

Display one message with content styling that matches its role in a conversation.

Before you copy and paste

Keep the example in the React rendering environment required by the imported component. Copy components/agents/message-bubble.tsx and its returned support files from the Code tab; preserve the project-relative paths.

Listed package dependencies: clsx, lucide-react, motion, react, react-dom, tailwind-merge.

Use the Code tab for the component files and installation instructions, then adapt the imports in this example to your project.

Display one message with content styling that matches its role in a conversation

// Usage adapted from beUI's pinned MIT source.
// Copyright (c) 2026 Saurabh Chauhan. See ./LICENSES.md.
"use client";

import { ChatPreview } from "@/components/previews/agents/chat-preview";

export function MessageBubblePreview() {
  return (
    <ChatPreview
      reply="That message mounted once with a spring pop. Streaming updates only change its content, so the entrance does not replay."
      placeholder="Send a bubble…"
    />
  );
}

Usage example adapted from beUI's pinned MIT source. Retain the source licence notices when copying.

Use semantic message structure around the bubble, and provide real text content or a deliberately sanitized renderer for rich output.

Customization

MessageBubbleProps.variant
Optional; MessageBubbleVariant.
MessageBubbleProps.align
Optional; MessageBubbleAlign. Defaults to the surrounding Message alignment when omitted.
MessageBubbleProps.animateIn
Optional; boolean. Plays the bubble entrance once when this component mounts.
MessageBubbleProps.children
Optional; ReactNode.
MessageBubbleContentProps.render
Optional; ReactElement. Replaces the content element while preserving bubble styling.
MessageBubbleGroupProps.spacing
Optional; "compact" | "default".
MessageBubbleCollapsibleProps.open
Optional; boolean.
MessageBubbleCollapsibleProps.defaultOpen
Optional; boolean.
MessageBubbleCollapsibleProps.onOpenChange
Optional; (open: boolean) => void.
MessageBubbleCollapsibleProps.collapsedLines
Optional; 2 | 3 | 4 | 5 | 6.
MessageBubbleCollapsibleProps.moreLabel
Optional; ReactNode.
MessageBubbleCollapsibleProps.lessLabel
Optional; ReactNode.
MessageBubbleCollapsibleProps.contentClassName
Optional; string.
MessageBubbleCollapsibleProps.triggerClassName
Optional; string.

Integration notes

  • Do not use bubble alignment as the only indication of who spoke.
  • When collapsing long content, check keyboard access to the toggle and preserve a clear way to read the full message.

Component source: beUI documentation . These examples describe the version imported into Rendyn. Upstream APIs may have changed; retain the source licence notices when adapting the code.

Better with your agent

Give your agent taste.

The best way to use Rendyn is through MCP. Let your agent find the right component, compare previews and bring the source into your project.

All components are free. Sign up only to connect MCP.

Connect to MCP