mayurrawte

Chat Bubble

Component

About

A styled message bubble for chat and AI assistant UIs, supporting user/assistant alignment variants, an avatar, a timestamp, and an animated typing indicator.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Chat Bubble to your project and fits it to your theme.

Code

How Chat Bubble is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import {
  ChatBubble,
  ChatBubbleAvatar,
  ChatBubbleContent,
  ChatBubbleTimestamp,
} from "@/components/ui/chat-bubble";

export default function ChatBubbleDemo() {
  return (
    <div className="flex w-full max-w-md flex-col gap-4">
      <ChatBubble variant="user">
        <ChatBubbleContent>How do I add a component?</ChatBubbleContent>
        <ChatBubbleTimestamp>9:41 AM</ChatBubbleTimestamp>
      </ChatBubble>
      <ChatBubble variant="ai">
        <ChatBubbleAvatar
          src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Crect width='32' height='32' rx='16' fill='%236366f1'/%3E%3Ctext x='16' y='21' font-size='14' fill='white' text-anchor='middle' font-family='sans-serif'%3EA%3C/text%3E%3C/svg%3E"
          alt="Assistant"
        />
        <ChatBubbleContent>
          Run `npx mcp-elements add button` and it copies into your project.
        </ChatBubbleContent>
        <ChatBubbleTimestamp>9:41 AM</ChatBubbleTimestamp>
      </ChatBubble>
    </div>
  );
}

Dependencies

More by mayurrawte

View all
  • Feedback Buttons

    Feedback Buttons

    4
  • Streaming Text

    Streaming Text

    4
  • MCP Scope Inspector

    MCP Scope Inspector

    2
  • Tooltip

    Tooltip

    2
  • Accordion

    Accordion

    2
  • Skeleton

    Skeleton

    2
  • Select Dropdown

    Select Dropdown

    1
  • Loader

    Loader

    1