For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. An agent skill is available at /.well-known/agent-skills/site-skill.md.
FrakmentFrakment

Message

A complete message row with markdown content and inline action buttons.

ME
Deploying to prod real quick.
OL
It is 4:55 PM. On a Friday.
ME
It is a one-line change.
Delivered
OL
It is always a one-line change.
Alright, let me take a look.
👍
Oliver is typing...
message-demo.tsx
"use client";

import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import { Marker, MarkerContent } from "@/components/ui/marker";
import {
  Bubble,
  BubbleContent,
  BubbleGroup,
  BubbleReactions,
  Message,
  MessageAvatar,
  MessageContent,
  MessageFooter,
} from "@/components/ui/message";

export function MessageDemo() {
  return (
    <div className="flex w-full max-w-sm flex-col gap-6 py-12">
      <Message align="end">
        <MessageAvatar>
          <Avatar>
            <AvatarImage alt="@me" src="/avatars/female-l-1.avif" />
            <AvatarFallback>ME</AvatarFallback>
          </Avatar>
        </MessageAvatar>
        <MessageContent>
          <Bubble>
            <BubbleContent>Deploying to prod real quick.</BubbleContent>
          </Bubble>
        </MessageContent>
      </Message>
      <Message>
        <MessageAvatar>
          <Avatar>
            <AvatarImage alt="@oliver" src="/avatars/male-r.avif" />
            <AvatarFallback>OL</AvatarFallback>
          </Avatar>
        </MessageAvatar>
        <MessageContent>
          <Bubble variant="muted">
            <BubbleContent>It is 4:55 PM. On a Friday.</BubbleContent>
          </Bubble>
        </MessageContent>
      </Message>
      <Message align="end">
        <MessageAvatar>
          <Avatar>
            <AvatarImage alt="@me" src="/avatars/female-l-1.avif" />
            <AvatarFallback>ME</AvatarFallback>
          </Avatar>
        </MessageAvatar>
        <MessageContent>
          <Bubble>
            <BubbleContent>It is a one-line change.</BubbleContent>
          </Bubble>
          <MessageFooter>Delivered</MessageFooter>
        </MessageContent>
      </Message>
      <Message>
        <MessageAvatar>
          <Avatar>
            <AvatarImage alt="@oliver" src="/avatars/male-r.avif" />
            <AvatarFallback>OL</AvatarFallback>
          </Avatar>
        </MessageAvatar>
        <MessageContent>
          <BubbleGroup>
            <Bubble variant="muted">
              <BubbleContent>It is always a one-line change.</BubbleContent>
            </Bubble>
            <Bubble variant="muted">
              <BubbleContent>Alright, let me take a look.</BubbleContent>
              <BubbleReactions aria-label="Reactions: thumbs up">
                <span>👍</span>
              </BubbleReactions>
            </Bubble>
          </BubbleGroup>
        </MessageContent>
      </Message>
      <Marker role="status">
        <MarkerContent className="shimmer">
          <span className="font-medium">Oliver</span> is typing...
        </MarkerContent>
      </Marker>
    </div>
  );
}

Message Pattern shows a user turn and an assistant turn with the pieces that make a real conversation feel finished: markdown content, a copy action, feedback buttons, and a retry action. It composes Message, Bubble, Tooltip, Button, and Markdown.

Message is a composition, not a primitive. Install the five primitives it uses, then wire it the same way the demo does.

Installation

Usage

message-demo.tsx
import { Markdown } from "@/components/ui/markdown";
import { Bubble, BubbleContent } from "@/components/ui/message";
import { Button } from "@/components/ui/button";
import {
  Message,
  MessageContent,
  MessageFooter,
} from "@/components/ui/message";
import {
  Tooltip,
  TooltipContent,
  TooltipTrigger,
} from "@/components/ui/tooltip";
 
<Message>
  <MessageContent className="gap-2">
    <Markdown>{reply}</Markdown>
    <MessageFooter className="px-0">
      <MessageAction label="Copy"><CopyIcon /></MessageAction>
      <MessageAction label="Retry"><RefreshCcwIcon /></MessageAction>
    </MessageFooter>
  </MessageContent>
</Message>

Anatomy

message-demo.tsx
<Message align="end">
  <MessageContent>
    <Bubble align="end" variant="muted">
      <BubbleContent>{userText}</BubbleContent>
    </Bubble>
    <MessageFooter>
      <MessageAction label="Copy"><CopyIcon /></MessageAction>
      <MessageAction label="Edit"><PencilIcon /></MessageAction>
    </MessageFooter>
  </MessageContent>
</Message>
 
<Message>
  <MessageContent>
    <Markdown>{reply}</Markdown>
    <MessageFooter>
      <MessageAction label="Copy"><CopyIcon /></MessageAction>
      <MessageAction label="Good response"><ThumbsUpIcon /></MessageAction>
      <MessageAction label="Bad response"><ThumbsDownIcon /></MessageAction>
      <MessageAction label="Retry"><RefreshCcwIcon /></MessageAction>
    </MessageFooter>
  </MessageContent>
</Message>
  • Message — the row, with align for user (end) or assistant (start).
  • MessageContent — vertical stack for bubble + footer.
  • Bubble, BubbleContent — the surface for the user message.
  • Markdown — renders the assistant reply, including fenced code blocks.
  • MessageFooter — horizontal action row aligned to the message.
  • MessageAction — a Button wrapped in a Tooltip, with aria-label for the icon.

Copy feedback

The copy action swaps to a checkmark for two seconds after clicking. Wire it with a single state:

tsx
const [copied, setCopied] = React.useState(false);
React.useEffect(() => {
  if (!copied) return;
  const t = setTimeout(() => setCopied(false), 2000);
  return () => clearTimeout(t);
}, [copied]);

Feedback toggle

Like and dislike are independent toggles. Track a single feedback state and use aria-pressed so screen readers announce the state:

tsx
<MessageAction
  aria-pressed={feedback === "like"}
  label="Good response"
  onClick={() => setFeedback(feedback === "like" ? null : "like")}
>
  <ThumbsUpIcon className={feedback === "like" ? "fill-current" : undefined} />
</MessageAction>

Best Practices

  • Only show actions after the response finishes streaming. A copy button on a partially-streamed reply copies incomplete text.
  • Use real buttons, not styled text. MessageAction renders a Button inside a Tooltip — keep that structure so keyboard users can reach it.
  • Icon-only actions need a label. Pass aria-label and put the same string in the tooltip.
  • Keep the footer aligned with the message. Do not use justify-between to spread the actions; they cluster.
  • Do not nest interactive content inside Bubble. Actions belong in MessageFooter.

Accessibility

  • Each MessageAction is a real <button> with aria-label matching its tooltip.
  • Feedback toggles use aria-pressed so screen readers announce "pressed" or "not pressed".
  • The copy state is announced via the tooltip and the swapped icon; the button keeps its accessible name throughout.
  • Code blocks render inside Markdown and preserve syntax highlighting for screen readers.

Next

  • Chat — full streaming chat surface.
  • Message — message row primitive.
  • Bubble — chat bubble surface.
  • Markdown — render markdown with code blocks.