{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "message-bubble",
  "type": "registry:ui",
  "title": "MessageBubble",
  "description": "Conversation message",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "agent",
    "ui",
    "react"
  ],
  "docs": "https://agent-ui-27t.pages.dev/docs/message-bubble",
  "files": [
    {
      "path": "packages/react/src/message-bubble.tsx",
      "type": "registry:ui",
      "target": "@ui/message-bubble.tsx",
      "content": "import * as React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface MessageBubbleProps extends React.HTMLAttributes<HTMLElement> {\n  role: \"user\" | \"assistant\" | \"system\";\n  children: React.ReactNode;\n  avatar?: string;\n  name?: string;\n  timestamp?: Date;\n  status?: \"sending\" | \"sent\" | \"error\" | \"cancelled\";\n}\n\nconst roleLabel = { user: \"User message\", assistant: \"Assistant message\", system: \"System message\" };\n\nconst MessageBubble = React.forwardRef<HTMLElement, MessageBubbleProps>(\n  ({ role, children, avatar, name, timestamp, status, className, ...props }, ref) => (\n    <article\n      ref={ref}\n      role=\"article\"\n      aria-label={roleLabel[role]}\n      data-agent-id=\"message-bubble\"\n      data-agent-role={role}\n      data-agent-state={status ?? \"ready\"}\n      className={cn(\"flex min-w-0 gap-3\", role === \"user\" && \"flex-row-reverse\", className)}\n      {...props}\n    >\n      {avatar && <img src={avatar} alt=\"\" className=\"h-8 w-8 shrink-0 rounded-full object-cover\" />}\n      <div className={cn(\"max-w-[min(85%,48rem)] min-w-0 space-y-1\", role === \"user\" && \"items-end\")}>\n        {(name || timestamp) && (\n          <div className={cn(\"flex items-center gap-2 text-xs text-muted-foreground\", role === \"user\" && \"justify-end\")}>\n            {name && <span className=\"font-medium\">{name}</span>}\n            {timestamp && <time dateTime={timestamp.toISOString()} suppressHydrationWarning>{timestamp.toLocaleTimeString()}</time>}\n          </div>\n        )}\n        <div\n          className={cn(\n            \"min-w-0 break-words rounded-2xl px-4 py-2.5 text-sm leading-relaxed\",\n            role === \"user\" && \"bg-primary text-primary-foreground\",\n            role === \"assistant\" && \"bg-muted\",\n            role === \"system\" && \"bg-secondary text-secondary-foreground italic\"\n          )}\n        >\n          {children}\n        </div>\n        {status && (\n          <div className=\"text-xs text-muted-foreground\" role={status === \"error\" ? \"status\" : undefined}>\n            {status === \"sending\" && \"Sending…\"}\n            {status === \"sent\" && \"Sent\"}\n            {status === \"error\" && \"Failed to send\"}\n            {status === \"cancelled\" && \"Stopped\"}\n          </div>\n        )}\n      </div>\n    </article>\n  )\n);\nMessageBubble.displayName = \"MessageBubble\";\n\nexport { MessageBubble };\n"
    }
  ]
}