# Message

Display one message with its author, content, and optional actions.

## Preview

message-preview-1.jsx

```jsx
import { CircleCheck } from "lucide-react";
import { useState as useState3 } from "react";
import { Avatar } from "@/components/ui/avatar";
import { MessageActions as MessageActions2 } from "@/components/ui/message-actions";
import {
  Activity,
  ActivityContent,
  ActivityEventRow,
  ActivityList,
  ActivityTitle,
  ActivityTrigger,
} from "@/components/ui/activity";
import {
  Citation,
  CitationList,
  CitationProvider,
} from "@/components/ui/citation";
import {
  Message as Message3,
  MessageAvatar,
  MessageBody as MessageBody3,
  MessageContent as MessageContent2,
  MessageFooter as MessageFooter2,
  MessageHeader,
} from "@/components/ui/message";

export default function Example() {
  const [vote, setVote] = useState3(null);
  const [feedback, setFeedback] = useState3("");
  const share = async () => {
    if (!navigator.share) {
      setFeedback("Sharing is not available in this browser.");
      return;
    }
    try {
      await navigator.share({
        title: "Launch review",
        text: "Staging data is stale across all regions.\nRollout still has no owner. Priya holds staging, support sits with you, and the reply for Marta waits on the final numbers.\nTell me which risk to escalate first.",
      });
    } catch {
      setFeedback("Sharing was cancelled.");
    }
  };
  const download = () => {
    const url = URL.createObjectURL(
      new Blob(
        [
          "Staging data is stale across all regions.\nRollout still has no owner. Priya holds staging, support sits with you, and the reply for Marta waits on the final numbers.\nTell me which risk to escalate first.",
        ],
        {
          type: "text/plain",
        },
      ),
    );
    const anchor = document.createElement("a");
    anchor.href = url;
    anchor.download = "launch-review.txt";
    anchor.click();
    URL.revokeObjectURL(url);
  };
  return (
    <CitationProvider
      citationOrder={["review", "runbook", "support", "status", "coverage"]}
      sources={[
        {
          id: "review",
          type: "document",
          title: "launch-review.pdf",
          document: {
            name: "launch-review.pdf",
          },
        },
        {
          id: "runbook",
          type: "document",
          title: "Release runbook",
          document: {
            name: "release-runbook.md",
          },
        },
        {
          id: "support",
          type: "url",
          title: "support.acme.co",
          url: "https://support.acme.co",
        },
        {
          id: "status",
          type: "document",
          title: "Staging status",
          document: {
            name: "staging-status.md",
          },
        },
        {
          id: "coverage",
          type: "document",
          title: "Coverage review",
          document: {
            name: "coverage-review.md",
          },
        },
      ]}
    >
      <div
        data-preview-wide
        style={{
          display: "grid",
          gap: "var(--space-4)",
        }}
      >
        <Message3 actor="assistant">
          <MessageAvatar>
            <Avatar name="Launch analyst" kind="agent" seed="launch-analyst" />
          </MessageAvatar>
          <MessageContent2>
            <Activity status="complete">
              <ActivityTrigger>
                <ActivityEventRow
                  event={{
                    id: "launch-review",
                    kind: "review",
                    state: "complete",
                    label: "Worked for 14s",
                    icon: (
                      <CircleCheck size={14} color="var(--color-success)" />
                    ),
                  }}
                  title={
                    <MessageHeader render={<ActivityTitle />}>
                      Launch analyst
                    </MessageHeader>
                  }
                />
              </ActivityTrigger>
              <ActivityContent>
                <ActivityList
                  events={[
                    {
                      id: "worker",
                      kind: "model",
                      state: "complete",
                      label: "Release readiness",
                      description:
                        "Compared launch owners, staging status, and the support handoff.",
                    },
                    {
                      id: "status",
                      kind: "source",
                      state: "complete",
                      label: "Staging status",
                      meta: "retry fix needed",
                    },
                  ]}
                />
              </ActivityContent>
            </Activity>
            <MessageBody3>
              <p>
                {"Staging data is stale across all regions. "}
                <Citation sourceIds={["review"]} />
              </p>
              <p>
                {
                  "Rollout still has no owner. Priya holds staging, support sits with you, and the reply for Marta waits on the final numbers. "
                }
                <Citation sourceIds={["support", "status", "coverage"]} />
              </p>
              <p>Tell me which risk to escalate first.</p>
            </MessageBody3>
            <MessageFooter2>
              <MessageActions2
                text={
                  "Staging data is stale across all regions.\nRollout still has no owner. Priya holds staging, support sits with you, and the reply for Marta waits on the final numbers.\nTell me which risk to escalate first."
                }
                vote={vote}
                onVote={setVote}
                onShare={() => void share()}
                onDownload={download}
                sources={<CitationList />}
              />
            </MessageFooter2>
          </MessageContent2>
        </Message3>
        <span className="ui-sr-only" role="status">
          {feedback}
        </span>
      </div>
    </CitationProvider>
  );
}

var orbit =
  "data:image/svg+xml," +
  encodeURIComponent(
    '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><rect x="1" y="1" width="30" height="30" rx="10" fill="#8C78EA"/><path d="M16 6l3 7 7 3-7 3-3 7-3-7-7-3 7-3z" fill="white"/></svg>',
  );

var rows = [
  ["\u{1F50E}", "Magnifying glass", "frequent", "mag", "#8aaab7"],
  ["\u{1F9E0}", "Brain", "frequent", "brain", "#d879a6"],
  ["\u2728", "Sparkles", "frequent", "sparkles", "#e5b832"],
  ["\u{1F916}", "Robot", "frequent", "robot", "#6aa3bb"],
  ["\u{1F4DA}", "Books", "frequent", "books", "#4caa75"],
  ["\u{1F4A1}", "Light bulb", "frequent", "bulb", "#e9bd38"],
  ["\u{1F52C}", "Microscope", "frequent", "microscope", "#6c9cac"],
  ["\u{1F680}", "Rocket", "frequent", "rocket", "#ec6f50"],
  ["\u{1F600}", "Grinning face", "smileys", "grinning"],
  ["\u{1F60A}", "Smiling face", "smileys", "blush"],
  ["\u{1F602}", "Tears of joy", "smileys", "joy"],
  ["\u{1F979}", "Holding back tears", "smileys", "holding_back_tears"],
  ["\u{1F60D}", "Heart eyes", "smileys", "heart_eyes"],
  ["\u{1F914}", "Thinking face", "smileys", "thinking"],
  ["\u{1F60E}", "Sunglasses", "smileys", "sunglasses"],
  ["\u{1F973}", "Partying face", "smileys", "partying_face"],
  ["\u{1F917}", "Hugging face", "smileys", "hugs"],
  ["\u{1F60C}", "Relieved face", "smileys", "relieved"],
  ["\u{1F929}", "Star eyes", "smileys", "star_struck"],
  ["\u{1F605}", "Grinning with sweat", "smileys", "sweat_smile"],
  ["\u{1F44B}", "Waving hand", "smileys", "wave"],
  ["\u{1F44D}", "Thumbs up", "smileys", "+1"],
  ["\u{1F64F}", "Folded hands", "smileys", "pray"],
  ["\u{1F4AA}", "Flexed biceps", "smileys", "muscle"],
  ["\u{1F3A8}", "Artist palette", "objects", "art"],
  ["\u{1F4DD}", "Memo", "objects", "memo"],
  ["\u{1F310}", "Globe", "objects", "globe_with_meridians"],
  ["\u{1F4CA}", "Bar chart", "objects", "bar_chart"],
  ["\u{1F4AC}", "Speech balloon", "objects", "speech_balloon"],
  ["\u2B50", "Star", "objects", "star"],
  ["\u{1F3AF}", "Direct hit", "objects", "dart"],
  ["\u2764\uFE0F", "Red heart", "reactions", "heart", "#e75b52"],
  ["\u{1F389}", "Party popper", "reactions", "tada", "#e5b832"],
  ["\u{1F440}", "Eyes", "reactions", "eyes"],
];

var demoItems = rows.map((row) => ({
  id: row[3],
  label: row[1],
  content: {
    type: "emoji",
    text: row[0],
  },
  category: row[2],
  shortcodes: [row[3]],
  keywords: [
    row[1],
    row[3].replaceAll("_", " "),
    ...(row[3] === "microscope" ? ["science", "research"] : []),
  ],
  accent:
    row.length > 4 ? row[4] : row[2] === "smileys" ? "#e7b52b" : undefined,
  ...(["wave", "+1", "pray", "muscle"].includes(row[3])
    ? {
        variants: [
          "\u{1F3FB}",
          "\u{1F3FC}",
          "\u{1F3FD}",
          "\u{1F3FE}",
          "\u{1F3FF}",
        ].map((modifier, index) => ({
          id: `tone-${index + 1}`,
          tone: index + 1,
          content: {
            type: "emoji",
            text: row[0] + modifier,
          },
        })),
      }
    : {}),
}));

var workspaceItems = [
  ...demoItems.filter(
    (item) => item.category === "frequent" || item.category === "smileys",
  ),
  {
    id: "orbit",
    label: "Orbit",
    content: {
      type: "image",
      src: orbit,
    },
    category: "objects",
    categories: ["custom"],
    shortcodes: ["orbit"],
    accent: "#8c78ea",
  },
  ...demoItems.filter((item) => item.category === "objects"),
];

```

## Design guidance

Message renders a named article. aria-labelledby, aria-label, and label take precedence in that order over the default name. Streaming sets aria-busy while keeping focus in place. Provide a separate status region if updates need announcements.

Human bubbles fit their content. Incoming bubbles reserve a 44px gutter on the opposite side. Your outgoing bubbles reserve 88px on the left for two avatar lanes and their gaps. Avatar and grouped-message offsets stay 44px even when identity is hidden. Agent and assistant messages can use the full content width.

Put time, receipts, citations, reactions, and commands in MessageFooter by default. In a text bubble, use MessageMeta placement="inline" for time, delivery, or edit status at the end of the final line. That metadata wraps together when space runs out. Keep the footer for media and rich content. See [Conversation defaults](/ai-elements/conversation#context-defaults) and [Message actions](/ai-elements/message-actions#commands).

Use actionsReveal to control when commands appear and metadataAtRest for time, receipts, and citations. Saved reactions can stay visible while commands are hidden.

Standalone assistant and system messages keep commands and supplied metadata visible. Human messages reveal commands on interaction. Your own message metadata also appears on interaction, while incoming message metadata stays visible. A complete [Conversation roster](/ai-elements/conversation#context-defaults) can set different defaults. Explicit Message or part props win. The toolbar and context menu invoke the same supported callbacks.

**Also known as**

Message bubble, Chat bubble.

## Installation

Add Message with shadcn. The registry includes its shared chat model dependency.

```sh
npx shadcn@latest add https://ghost-ui.com/r/message.json
```

```text
src/components/ui/chat-model.ts
src/components/ui/message.tsx
src/components/ui/message.css
```

## Basic usage

Message renders a named article. Keep the body and any optional parts inside it; keep participant facts and side effects in the host.

```tsx
import { Message, MessageBody } from "@/components/ui/message";

export function MessageExample() {
  return (
    <Message actor="assistant">
      <MessageBody>Staging passed the retry check.</MessageBody>
    </Message>
  );
}
```

## Structures

MessageExpandButton uses the Message disclosure context to expand or collapse its body. It hides when the body does not overflow.

- MessageGroup (optional grouping)
  - Message
    - MessageAvatar (optional)
    - MessageContent
      - MessageHeader (optional)
      - MessageBody
        - MessageAttachments (optional)
        - Caller-owned text, media, or Markdown
        - MessageMeta (optional inline delivery tail, text content only)
      - MessageFooter (optional footer region)
    - MessageToolbar (optional direct sibling)
      - MessageReactions (optional)
      - MessageMeta (optional)
      - Toolbar groups with MessageActions (optional)

For long content, place MessageContent and MessageFooter inside MessageBody. Set maxLines on MessageContent so the text can collapse while the footer and disclosure control stay reachable.

- Message
  - MessageBody
    - MessageContent (maxLines clips only this text)
    - MessageFooter
      - MessageMeta (optional)
      - MessageExpandButton (optional)

MessageAvatar is a direct sibling of MessageContent and uses a fixed identity lane. MessageContent groups the optional header, body, and footer. Put a floating MessageToolbar directly under Message; it can contain timestamp/delivery metadata, command, and saved-reaction groups in that order. For human text, append MessageMeta placement="inline" inside MessageBody after the final text only when the compact tail fits the task. The inline-end footprint aligns at the bubble edge and reserves its rendered width as text wraps; timestamp, delivery mark, and an optional Edited or Not sent label stay together. Keep commands and reactions outside this tail. Use the footer for media and rich block compositions because their final-line geometry is not predictable.

## Examples

### Appearance

Use the surface to express message styling. The status prop describes lifecycle separately. A failed outgoing human item may choose the critical appearance explicitly; its idle delivery fact belongs once in MessageMeta, while MessageActions owns Retry/Delete and pending or rejected-command feedback. A generic error does not change an authored surface. Use MessageMeta placement="inline" after final plain text when its width is useful; for files and other rich parts, put compact delivery metadata in the footer because their final-line geometry is not predictable.

#### Subtle and subtle alternative

Use subtle for your own human message and subtle alternative for another human. Keep the older appearance aliases for compatibility.

message-subtle-and-subtle-alternative-2.jsx

```jsx
import {
  Message as Message3,
  MessageBody as MessageBody3,
} from "@/components/ui/message";

export default function Example() {
  return (
    <div
      data-preview-wide
      style={{
        display: "grid",
        gap: "var(--space-3)",
      }}
    >
      <Message3 actor="user">
        <MessageBody3>
          I’ll confirm regional coverage before Friday.
        </MessageBody3>
      </Message3>
      <Message3 actor="user" self={false}>
        <MessageBody3>
          Marta will confirm regional coverage before Friday.
        </MessageBody3>
      </Message3>
    </div>
  );
}

var orbit =
  "data:image/svg+xml," +
  encodeURIComponent(
    '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><rect x="1" y="1" width="30" height="30" rx="10" fill="#8C78EA"/><path d="M16 6l3 7 7 3-7 3-3 7-3-7-7-3 7-3z" fill="white"/></svg>',
  );

var rows = [
  ["\u{1F50E}", "Magnifying glass", "frequent", "mag", "#8aaab7"],
  ["\u{1F9E0}", "Brain", "frequent", "brain", "#d879a6"],
  ["\u2728", "Sparkles", "frequent", "sparkles", "#e5b832"],
  ["\u{1F916}", "Robot", "frequent", "robot", "#6aa3bb"],
  ["\u{1F4DA}", "Books", "frequent", "books", "#4caa75"],
  ["\u{1F4A1}", "Light bulb", "frequent", "bulb", "#e9bd38"],
  ["\u{1F52C}", "Microscope", "frequent", "microscope", "#6c9cac"],
  ["\u{1F680}", "Rocket", "frequent", "rocket", "#ec6f50"],
  ["\u{1F600}", "Grinning face", "smileys", "grinning"],
  ["\u{1F60A}", "Smiling face", "smileys", "blush"],
  ["\u{1F602}", "Tears of joy", "smileys", "joy"],
  ["\u{1F979}", "Holding back tears", "smileys", "holding_back_tears"],
  ["\u{1F60D}", "Heart eyes", "smileys", "heart_eyes"],
  ["\u{1F914}", "Thinking face", "smileys", "thinking"],
  ["\u{1F60E}", "Sunglasses", "smileys", "sunglasses"],
  ["\u{1F973}", "Partying face", "smileys", "partying_face"],
  ["\u{1F917}", "Hugging face", "smileys", "hugs"],
  ["\u{1F60C}", "Relieved face", "smileys", "relieved"],
  ["\u{1F929}", "Star eyes", "smileys", "star_struck"],
  ["\u{1F605}", "Grinning with sweat", "smileys", "sweat_smile"],
  ["\u{1F44B}", "Waving hand", "smileys", "wave"],
  ["\u{1F44D}", "Thumbs up", "smileys", "+1"],
  ["\u{1F64F}", "Folded hands", "smileys", "pray"],
  ["\u{1F4AA}", "Flexed biceps", "smileys", "muscle"],
  ["\u{1F3A8}", "Artist palette", "objects", "art"],
  ["\u{1F4DD}", "Memo", "objects", "memo"],
  ["\u{1F310}", "Globe", "objects", "globe_with_meridians"],
  ["\u{1F4CA}", "Bar chart", "objects", "bar_chart"],
  ["\u{1F4AC}", "Speech balloon", "objects", "speech_balloon"],
  ["\u2B50", "Star", "objects", "star"],
  ["\u{1F3AF}", "Direct hit", "objects", "dart"],
  ["\u2764\uFE0F", "Red heart", "reactions", "heart", "#e75b52"],
  ["\u{1F389}", "Party popper", "reactions", "tada", "#e5b832"],
  ["\u{1F440}", "Eyes", "reactions", "eyes"],
];

var demoItems = rows.map((row) => ({
  id: row[3],
  label: row[1],
  content: {
    type: "emoji",
    text: row[0],
  },
  category: row[2],
  shortcodes: [row[3]],
  keywords: [
    row[1],
    row[3].replaceAll("_", " "),
    ...(row[3] === "microscope" ? ["science", "research"] : []),
  ],
  accent:
    row.length > 4 ? row[4] : row[2] === "smileys" ? "#e7b52b" : undefined,
  ...(["wave", "+1", "pray", "muscle"].includes(row[3])
    ? {
        variants: [
          "\u{1F3FB}",
          "\u{1F3FC}",
          "\u{1F3FD}",
          "\u{1F3FE}",
          "\u{1F3FF}",
        ].map((modifier, index) => ({
          id: `tone-${index + 1}`,
          tone: index + 1,
          content: {
            type: "emoji",
            text: row[0] + modifier,
          },
        })),
      }
    : {}),
}));

var workspaceItems = [
  ...demoItems.filter(
    (item) => item.category === "frequent" || item.category === "smileys",
  ),
  {
    id: "orbit",
    label: "Orbit",
    content: {
      type: "image",
      src: orbit,
    },
    category: "objects",
    categories: ["custom"],
    shortcodes: ["orbit"],
    accent: "#8c78ea",
  },
  ...demoItems.filter((item) => item.category === "objects"),
];

```

#### Plain

Agent content can sit directly on the surrounding surface.

message-plain-3.jsx

```jsx
import {
  Message as Message3,
  MessageBody as MessageBody3,
} from "@/components/ui/message";

export default function Example() {
  return (
    <Message3 actor="assistant">
      <MessageBody3>
        Staging is stable. Rollout coverage and the support handoff still need
        owners.
      </MessageBody3>
    </Message3>
  );
}

var orbit =
  "data:image/svg+xml," +
  encodeURIComponent(
    '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><rect x="1" y="1" width="30" height="30" rx="10" fill="#8C78EA"/><path d="M16 6l3 7 7 3-7 3-3 7-3-7-7-3 7-3z" fill="white"/></svg>',
  );

var rows = [
  ["\u{1F50E}", "Magnifying glass", "frequent", "mag", "#8aaab7"],
  ["\u{1F9E0}", "Brain", "frequent", "brain", "#d879a6"],
  ["\u2728", "Sparkles", "frequent", "sparkles", "#e5b832"],
  ["\u{1F916}", "Robot", "frequent", "robot", "#6aa3bb"],
  ["\u{1F4DA}", "Books", "frequent", "books", "#4caa75"],
  ["\u{1F4A1}", "Light bulb", "frequent", "bulb", "#e9bd38"],
  ["\u{1F52C}", "Microscope", "frequent", "microscope", "#6c9cac"],
  ["\u{1F680}", "Rocket", "frequent", "rocket", "#ec6f50"],
  ["\u{1F600}", "Grinning face", "smileys", "grinning"],
  ["\u{1F60A}", "Smiling face", "smileys", "blush"],
  ["\u{1F602}", "Tears of joy", "smileys", "joy"],
  ["\u{1F979}", "Holding back tears", "smileys", "holding_back_tears"],
  ["\u{1F60D}", "Heart eyes", "smileys", "heart_eyes"],
  ["\u{1F914}", "Thinking face", "smileys", "thinking"],
  ["\u{1F60E}", "Sunglasses", "smileys", "sunglasses"],
  ["\u{1F973}", "Partying face", "smileys", "partying_face"],
  ["\u{1F917}", "Hugging face", "smileys", "hugs"],
  ["\u{1F60C}", "Relieved face", "smileys", "relieved"],
  ["\u{1F929}", "Star eyes", "smileys", "star_struck"],
  ["\u{1F605}", "Grinning with sweat", "smileys", "sweat_smile"],
  ["\u{1F44B}", "Waving hand", "smileys", "wave"],
  ["\u{1F44D}", "Thumbs up", "smileys", "+1"],
  ["\u{1F64F}", "Folded hands", "smileys", "pray"],
  ["\u{1F4AA}", "Flexed biceps", "smileys", "muscle"],
  ["\u{1F3A8}", "Artist palette", "objects", "art"],
  ["\u{1F4DD}", "Memo", "objects", "memo"],
  ["\u{1F310}", "Globe", "objects", "globe_with_meridians"],
  ["\u{1F4CA}", "Bar chart", "objects", "bar_chart"],
  ["\u{1F4AC}", "Speech balloon", "objects", "speech_balloon"],
  ["\u2B50", "Star", "objects", "star"],
  ["\u{1F3AF}", "Direct hit", "objects", "dart"],
  ["\u2764\uFE0F", "Red heart", "reactions", "heart", "#e75b52"],
  ["\u{1F389}", "Party popper", "reactions", "tada", "#e5b832"],
  ["\u{1F440}", "Eyes", "reactions", "eyes"],
];

var demoItems = rows.map((row) => ({
  id: row[3],
  label: row[1],
  content: {
    type: "emoji",
    text: row[0],
  },
  category: row[2],
  shortcodes: [row[3]],
  keywords: [
    row[1],
    row[3].replaceAll("_", " "),
    ...(row[3] === "microscope" ? ["science", "research"] : []),
  ],
  accent:
    row.length > 4 ? row[4] : row[2] === "smileys" ? "#e7b52b" : undefined,
  ...(["wave", "+1", "pray", "muscle"].includes(row[3])
    ? {
        variants: [
          "\u{1F3FB}",
          "\u{1F3FC}",
          "\u{1F3FD}",
          "\u{1F3FE}",
          "\u{1F3FF}",
        ].map((modifier, index) => ({
          id: `tone-${index + 1}`,
          tone: index + 1,
          content: {
            type: "emoji",
            text: row[0] + modifier,
          },
        })),
      }
    : {}),
}));

var workspaceItems = [
  ...demoItems.filter(
    (item) => item.category === "frequent" || item.category === "smileys",
  ),
  {
    id: "orbit",
    label: "Orbit",
    content: {
      type: "image",
      src: orbit,
    },
    category: "objects",
    categories: ["custom"],
    shortcodes: ["orbit"],
    accent: "#8c78ea",
  },
  ...demoItems.filter((item) => item.category === "objects"),
];

```

#### Solid

Choose a stronger surface explicitly.

message-solid-4.jsx

```jsx
import {
  Message as Message3,
  MessageBody as MessageBody3,
} from "@/components/ui/message";

export default function Example() {
  return (
    <Message3 actor="user">
      <MessageBody3 appearance="solid">
        I’ll own the support handoff.
      </MessageBody3>
    </Message3>
  );
}

var orbit =
  "data:image/svg+xml," +
  encodeURIComponent(
    '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><rect x="1" y="1" width="30" height="30" rx="10" fill="#8C78EA"/><path d="M16 6l3 7 7 3-7 3-3 7-3-7-7-3 7-3z" fill="white"/></svg>',
  );

var rows = [
  ["\u{1F50E}", "Magnifying glass", "frequent", "mag", "#8aaab7"],
  ["\u{1F9E0}", "Brain", "frequent", "brain", "#d879a6"],
  ["\u2728", "Sparkles", "frequent", "sparkles", "#e5b832"],
  ["\u{1F916}", "Robot", "frequent", "robot", "#6aa3bb"],
  ["\u{1F4DA}", "Books", "frequent", "books", "#4caa75"],
  ["\u{1F4A1}", "Light bulb", "frequent", "bulb", "#e9bd38"],
  ["\u{1F52C}", "Microscope", "frequent", "microscope", "#6c9cac"],
  ["\u{1F680}", "Rocket", "frequent", "rocket", "#ec6f50"],
  ["\u{1F600}", "Grinning face", "smileys", "grinning"],
  ["\u{1F60A}", "Smiling face", "smileys", "blush"],
  ["\u{1F602}", "Tears of joy", "smileys", "joy"],
  ["\u{1F979}", "Holding back tears", "smileys", "holding_back_tears"],
  ["\u{1F60D}", "Heart eyes", "smileys", "heart_eyes"],
  ["\u{1F914}", "Thinking face", "smileys", "thinking"],
  ["\u{1F60E}", "Sunglasses", "smileys", "sunglasses"],
  ["\u{1F973}", "Partying face", "smileys", "partying_face"],
  ["\u{1F917}", "Hugging face", "smileys", "hugs"],
  ["\u{1F60C}", "Relieved face", "smileys", "relieved"],
  ["\u{1F929}", "Star eyes", "smileys", "star_struck"],
  ["\u{1F605}", "Grinning with sweat", "smileys", "sweat_smile"],
  ["\u{1F44B}", "Waving hand", "smileys", "wave"],
  ["\u{1F44D}", "Thumbs up", "smileys", "+1"],
  ["\u{1F64F}", "Folded hands", "smileys", "pray"],
  ["\u{1F4AA}", "Flexed biceps", "smileys", "muscle"],
  ["\u{1F3A8}", "Artist palette", "objects", "art"],
  ["\u{1F4DD}", "Memo", "objects", "memo"],
  ["\u{1F310}", "Globe", "objects", "globe_with_meridians"],
  ["\u{1F4CA}", "Bar chart", "objects", "bar_chart"],
  ["\u{1F4AC}", "Speech balloon", "objects", "speech_balloon"],
  ["\u2B50", "Star", "objects", "star"],
  ["\u{1F3AF}", "Direct hit", "objects", "dart"],
  ["\u2764\uFE0F", "Red heart", "reactions", "heart", "#e75b52"],
  ["\u{1F389}", "Party popper", "reactions", "tada", "#e5b832"],
  ["\u{1F440}", "Eyes", "reactions", "eyes"],
];

var demoItems = rows.map((row) => ({
  id: row[3],
  label: row[1],
  content: {
    type: "emoji",
    text: row[0],
  },
  category: row[2],
  shortcodes: [row[3]],
  keywords: [
    row[1],
    row[3].replaceAll("_", " "),
    ...(row[3] === "microscope" ? ["science", "research"] : []),
  ],
  accent:
    row.length > 4 ? row[4] : row[2] === "smileys" ? "#e7b52b" : undefined,
  ...(["wave", "+1", "pray", "muscle"].includes(row[3])
    ? {
        variants: [
          "\u{1F3FB}",
          "\u{1F3FC}",
          "\u{1F3FD}",
          "\u{1F3FE}",
          "\u{1F3FF}",
        ].map((modifier, index) => ({
          id: `tone-${index + 1}`,
          tone: index + 1,
          content: {
            type: "emoji",
            text: row[0] + modifier,
          },
        })),
      }
    : {}),
}));

var workspaceItems = [
  ...demoItems.filter(
    (item) => item.category === "frequent" || item.category === "smileys",
  ),
  {
    id: "orbit",
    label: "Orbit",
    content: {
      type: "image",
      src: orbit,
    },
    category: "objects",
    categories: ["custom"],
    shortcodes: ["orbit"],
    accent: "#8c78ea",
  },
  ...demoItems.filter((item) => item.category === "objects"),
];

```

#### Outline

Add a boundary only where the product needs it.

message-outline-5.jsx

```jsx
import {
  Message as Message3,
  MessageBody as MessageBody3,
} from "@/components/ui/message";

export default function Example() {
  return (
    <Message3 actor="assistant">
      <MessageBody3 appearance="outline">
        Staging: Priya will confirm the retry fix.
      </MessageBody3>
    </Message3>
  );
}

var orbit =
  "data:image/svg+xml," +
  encodeURIComponent(
    '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><rect x="1" y="1" width="30" height="30" rx="10" fill="#8C78EA"/><path d="M16 6l3 7 7 3-7 3-3 7-3-7-7-3 7-3z" fill="white"/></svg>',
  );

var rows = [
  ["\u{1F50E}", "Magnifying glass", "frequent", "mag", "#8aaab7"],
  ["\u{1F9E0}", "Brain", "frequent", "brain", "#d879a6"],
  ["\u2728", "Sparkles", "frequent", "sparkles", "#e5b832"],
  ["\u{1F916}", "Robot", "frequent", "robot", "#6aa3bb"],
  ["\u{1F4DA}", "Books", "frequent", "books", "#4caa75"],
  ["\u{1F4A1}", "Light bulb", "frequent", "bulb", "#e9bd38"],
  ["\u{1F52C}", "Microscope", "frequent", "microscope", "#6c9cac"],
  ["\u{1F680}", "Rocket", "frequent", "rocket", "#ec6f50"],
  ["\u{1F600}", "Grinning face", "smileys", "grinning"],
  ["\u{1F60A}", "Smiling face", "smileys", "blush"],
  ["\u{1F602}", "Tears of joy", "smileys", "joy"],
  ["\u{1F979}", "Holding back tears", "smileys", "holding_back_tears"],
  ["\u{1F60D}", "Heart eyes", "smileys", "heart_eyes"],
  ["\u{1F914}", "Thinking face", "smileys", "thinking"],
  ["\u{1F60E}", "Sunglasses", "smileys", "sunglasses"],
  ["\u{1F973}", "Partying face", "smileys", "partying_face"],
  ["\u{1F917}", "Hugging face", "smileys", "hugs"],
  ["\u{1F60C}", "Relieved face", "smileys", "relieved"],
  ["\u{1F929}", "Star eyes", "smileys", "star_struck"],
  ["\u{1F605}", "Grinning with sweat", "smileys", "sweat_smile"],
  ["\u{1F44B}", "Waving hand", "smileys", "wave"],
  ["\u{1F44D}", "Thumbs up", "smileys", "+1"],
  ["\u{1F64F}", "Folded hands", "smileys", "pray"],
  ["\u{1F4AA}", "Flexed biceps", "smileys", "muscle"],
  ["\u{1F3A8}", "Artist palette", "objects", "art"],
  ["\u{1F4DD}", "Memo", "objects", "memo"],
  ["\u{1F310}", "Globe", "objects", "globe_with_meridians"],
  ["\u{1F4CA}", "Bar chart", "objects", "bar_chart"],
  ["\u{1F4AC}", "Speech balloon", "objects", "speech_balloon"],
  ["\u2B50", "Star", "objects", "star"],
  ["\u{1F3AF}", "Direct hit", "objects", "dart"],
  ["\u2764\uFE0F", "Red heart", "reactions", "heart", "#e75b52"],
  ["\u{1F389}", "Party popper", "reactions", "tada", "#e5b832"],
  ["\u{1F440}", "Eyes", "reactions", "eyes"],
];

var demoItems = rows.map((row) => ({
  id: row[3],
  label: row[1],
  content: {
    type: "emoji",
    text: row[0],
  },
  category: row[2],
  shortcodes: [row[3]],
  keywords: [
    row[1],
    row[3].replaceAll("_", " "),
    ...(row[3] === "microscope" ? ["science", "research"] : []),
  ],
  accent:
    row.length > 4 ? row[4] : row[2] === "smileys" ? "#e7b52b" : undefined,
  ...(["wave", "+1", "pray", "muscle"].includes(row[3])
    ? {
        variants: [
          "\u{1F3FB}",
          "\u{1F3FC}",
          "\u{1F3FD}",
          "\u{1F3FE}",
          "\u{1F3FF}",
        ].map((modifier, index) => ({
          id: `tone-${index + 1}`,
          tone: index + 1,
          content: {
            type: "emoji",
            text: row[0] + modifier,
          },
        })),
      }
    : {}),
}));

var workspaceItems = [
  ...demoItems.filter(
    (item) => item.category === "frequent" || item.category === "smileys",
  ),
  {
    id: "orbit",
    label: "Orbit",
    content: {
      type: "image",
      src: orbit,
    },
    category: "objects",
    categories: ["custom"],
    shortcodes: ["orbit"],
    accent: "#8c78ea",
  },
  ...demoItems.filter((item) => item.category === "objects"),
];

```

#### Critical failed outgoing surface

This preview explicitly selects critical for an unsent human item, keeps one Not sent fact in the bubble, and gives Retry/Delete useful local outcomes. The full retained-message retry transaction is in [MessageActions recovery](/ai-elements/message-actions#failed-send).

message-critical-failed-outgoing-surface-6.jsx

```jsx
import { useState as useState3 } from "react";
import { MessageActions as MessageActions2 } from "@/components/ui/message-actions";
import {
  Message as Message3,
  MessageBody as MessageBody3,
  MessageContent as MessageContent2,
  MessageFooter as MessageFooter2,
  MessageMeta as MessageMeta2,
} from "@/components/ui/message";

export default function Example() {
  const [state, setState] = useState3("error");
  if (state === "deleted")
    return <span role="status">Unsent message deleted.</span>;
  const failed = state === "error";
  return (
    <Message3
      actor="user"
      status={failed ? "error" : "complete"}
      actionsReveal={false}
      metadataAtRest
    >
      <MessageContent2>
        <MessageBody3 appearance={failed ? "critical" : "subtle"}>
          Can we move the rollout review to Friday?
          <MessageMeta2 placement="inline">
            <span
              role="status"
              data-delivery-status={failed ? "failed" : "sent"}
            >
              {failed ? "Not sent" : "Sent"}
            </span>
          </MessageMeta2>
        </MessageBody3>
        {failed && (
          <MessageFooter2>
            <MessageActions2
              text="Can we move the rollout review to Friday?"
              failed
              onRetry={() => setState("sent")}
              onDelete={() => setState("deleted")}
            />
          </MessageFooter2>
        )}
      </MessageContent2>
    </Message3>
  );
}

var orbit =
  "data:image/svg+xml," +
  encodeURIComponent(
    '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><rect x="1" y="1" width="30" height="30" rx="10" fill="#8C78EA"/><path d="M16 6l3 7 7 3-7 3-3 7-3-7-7-3 7-3z" fill="white"/></svg>',
  );

var rows = [
  ["\u{1F50E}", "Magnifying glass", "frequent", "mag", "#8aaab7"],
  ["\u{1F9E0}", "Brain", "frequent", "brain", "#d879a6"],
  ["\u2728", "Sparkles", "frequent", "sparkles", "#e5b832"],
  ["\u{1F916}", "Robot", "frequent", "robot", "#6aa3bb"],
  ["\u{1F4DA}", "Books", "frequent", "books", "#4caa75"],
  ["\u{1F4A1}", "Light bulb", "frequent", "bulb", "#e9bd38"],
  ["\u{1F52C}", "Microscope", "frequent", "microscope", "#6c9cac"],
  ["\u{1F680}", "Rocket", "frequent", "rocket", "#ec6f50"],
  ["\u{1F600}", "Grinning face", "smileys", "grinning"],
  ["\u{1F60A}", "Smiling face", "smileys", "blush"],
  ["\u{1F602}", "Tears of joy", "smileys", "joy"],
  ["\u{1F979}", "Holding back tears", "smileys", "holding_back_tears"],
  ["\u{1F60D}", "Heart eyes", "smileys", "heart_eyes"],
  ["\u{1F914}", "Thinking face", "smileys", "thinking"],
  ["\u{1F60E}", "Sunglasses", "smileys", "sunglasses"],
  ["\u{1F973}", "Partying face", "smileys", "partying_face"],
  ["\u{1F917}", "Hugging face", "smileys", "hugs"],
  ["\u{1F60C}", "Relieved face", "smileys", "relieved"],
  ["\u{1F929}", "Star eyes", "smileys", "star_struck"],
  ["\u{1F605}", "Grinning with sweat", "smileys", "sweat_smile"],
  ["\u{1F44B}", "Waving hand", "smileys", "wave"],
  ["\u{1F44D}", "Thumbs up", "smileys", "+1"],
  ["\u{1F64F}", "Folded hands", "smileys", "pray"],
  ["\u{1F4AA}", "Flexed biceps", "smileys", "muscle"],
  ["\u{1F3A8}", "Artist palette", "objects", "art"],
  ["\u{1F4DD}", "Memo", "objects", "memo"],
  ["\u{1F310}", "Globe", "objects", "globe_with_meridians"],
  ["\u{1F4CA}", "Bar chart", "objects", "bar_chart"],
  ["\u{1F4AC}", "Speech balloon", "objects", "speech_balloon"],
  ["\u2B50", "Star", "objects", "star"],
  ["\u{1F3AF}", "Direct hit", "objects", "dart"],
  ["\u2764\uFE0F", "Red heart", "reactions", "heart", "#e75b52"],
  ["\u{1F389}", "Party popper", "reactions", "tada", "#e5b832"],
  ["\u{1F440}", "Eyes", "reactions", "eyes"],
];

var demoItems = rows.map((row) => ({
  id: row[3],
  label: row[1],
  content: {
    type: "emoji",
    text: row[0],
  },
  category: row[2],
  shortcodes: [row[3]],
  keywords: [
    row[1],
    row[3].replaceAll("_", " "),
    ...(row[3] === "microscope" ? ["science", "research"] : []),
  ],
  accent:
    row.length > 4 ? row[4] : row[2] === "smileys" ? "#e7b52b" : undefined,
  ...(["wave", "+1", "pray", "muscle"].includes(row[3])
    ? {
        variants: [
          "\u{1F3FB}",
          "\u{1F3FC}",
          "\u{1F3FD}",
          "\u{1F3FE}",
          "\u{1F3FF}",
        ].map((modifier, index) => ({
          id: `tone-${index + 1}`,
          tone: index + 1,
          content: {
            type: "emoji",
            text: row[0] + modifier,
          },
        })),
      }
    : {}),
}));

var workspaceItems = [
  ...demoItems.filter(
    (item) => item.category === "frequent" || item.category === "smileys",
  ),
  {
    id: "orbit",
    label: "Orbit",
    content: {
      type: "image",
      src: orbit,
    },
    category: "objects",
    categories: ["custom"],
    shortcodes: ["orbit"],
    accent: "#8c78ea",
  },
  ...demoItems.filter((item) => item.category === "objects"),
];

```

### Header and identity

Conversation decides whether an identity belongs in a roster context. Message renders caller-provided identity and keeps it in the separate avatar lane when supplied. Product demos use Dylan for humans and Gaze with an AI indicator for agents; intentional photos and fallbacks remain supported.

#### Identity choices

message-identity-choices-7.jsx

```jsx
import { Avatar } from "@/components/ui/avatar";
import { Badge as Badge2 } from "@/components/ui/badge";
import {
  Message as Message3,
  MessageAvatar,
  MessageBody as MessageBody3,
  MessageContent as MessageContent2,
  MessageHeader,
} from "@/components/ui/message";

export default function Example() {
  return (
    <div
      data-preview-wide
      style={{
        display: "grid",
        gap: "var(--space-4)",
      }}
    >
      <Message3 actor="user" self={false} align="start">
        <MessageContent2>
          <MessageHeader>Marta Chen</MessageHeader>
          <MessageBody3>Regional coverage is ready for review.</MessageBody3>
        </MessageContent2>
      </Message3>
      <Message3 actor="user" self={false} align="start">
        <MessageAvatar>
          <Avatar
            name="Marta Chen"
            kind="human"
            seed="marta-chen"
            aria-hidden="true"
          />
        </MessageAvatar>
        <MessageContent2>
          <MessageHeader>Marta Chen</MessageHeader>
          <MessageBody3>I’ll check the final rollout coverage.</MessageBody3>
        </MessageContent2>
      </Message3>
      <Message3 actor="user" self={false} align="start">
        <MessageContent2>
          <MessageHeader>
            {"Marta Chen "}
            <Badge2 variant="subtle">Product manager</Badge2>
          </MessageHeader>
          <MessageBody3>The owners are listed in the review.</MessageBody3>
        </MessageContent2>
      </Message3>
      <Message3 actor="user" self={false} align="start">
        <MessageContent2>
          <MessageHeader>
            {"Marta Chen "}
            <time dateTime="2026-11-09T09:42:00+07:00">9:42 AM</time>
          </MessageHeader>
          <MessageBody3>
            Staging passed. I’ll watch the first cohort.
          </MessageBody3>
        </MessageContent2>
      </Message3>
    </div>
  );
}

var orbit =
  "data:image/svg+xml," +
  encodeURIComponent(
    '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><rect x="1" y="1" width="30" height="30" rx="10" fill="#8C78EA"/><path d="M16 6l3 7 7 3-7 3-3 7-3-7-7-3 7-3z" fill="white"/></svg>',
  );

var rows = [
  ["\u{1F50E}", "Magnifying glass", "frequent", "mag", "#8aaab7"],
  ["\u{1F9E0}", "Brain", "frequent", "brain", "#d879a6"],
  ["\u2728", "Sparkles", "frequent", "sparkles", "#e5b832"],
  ["\u{1F916}", "Robot", "frequent", "robot", "#6aa3bb"],
  ["\u{1F4DA}", "Books", "frequent", "books", "#4caa75"],
  ["\u{1F4A1}", "Light bulb", "frequent", "bulb", "#e9bd38"],
  ["\u{1F52C}", "Microscope", "frequent", "microscope", "#6c9cac"],
  ["\u{1F680}", "Rocket", "frequent", "rocket", "#ec6f50"],
  ["\u{1F600}", "Grinning face", "smileys", "grinning"],
  ["\u{1F60A}", "Smiling face", "smileys", "blush"],
  ["\u{1F602}", "Tears of joy", "smileys", "joy"],
  ["\u{1F979}", "Holding back tears", "smileys", "holding_back_tears"],
  ["\u{1F60D}", "Heart eyes", "smileys", "heart_eyes"],
  ["\u{1F914}", "Thinking face", "smileys", "thinking"],
  ["\u{1F60E}", "Sunglasses", "smileys", "sunglasses"],
  ["\u{1F973}", "Partying face", "smileys", "partying_face"],
  ["\u{1F917}", "Hugging face", "smileys", "hugs"],
  ["\u{1F60C}", "Relieved face", "smileys", "relieved"],
  ["\u{1F929}", "Star eyes", "smileys", "star_struck"],
  ["\u{1F605}", "Grinning with sweat", "smileys", "sweat_smile"],
  ["\u{1F44B}", "Waving hand", "smileys", "wave"],
  ["\u{1F44D}", "Thumbs up", "smileys", "+1"],
  ["\u{1F64F}", "Folded hands", "smileys", "pray"],
  ["\u{1F4AA}", "Flexed biceps", "smileys", "muscle"],
  ["\u{1F3A8}", "Artist palette", "objects", "art"],
  ["\u{1F4DD}", "Memo", "objects", "memo"],
  ["\u{1F310}", "Globe", "objects", "globe_with_meridians"],
  ["\u{1F4CA}", "Bar chart", "objects", "bar_chart"],
  ["\u{1F4AC}", "Speech balloon", "objects", "speech_balloon"],
  ["\u2B50", "Star", "objects", "star"],
  ["\u{1F3AF}", "Direct hit", "objects", "dart"],
  ["\u2764\uFE0F", "Red heart", "reactions", "heart", "#e75b52"],
  ["\u{1F389}", "Party popper", "reactions", "tada", "#e5b832"],
  ["\u{1F440}", "Eyes", "reactions", "eyes"],
];

var demoItems = rows.map((row) => ({
  id: row[3],
  label: row[1],
  content: {
    type: "emoji",
    text: row[0],
  },
  category: row[2],
  shortcodes: [row[3]],
  keywords: [
    row[1],
    row[3].replaceAll("_", " "),
    ...(row[3] === "microscope" ? ["science", "research"] : []),
  ],
  accent:
    row.length > 4 ? row[4] : row[2] === "smileys" ? "#e7b52b" : undefined,
  ...(["wave", "+1", "pray", "muscle"].includes(row[3])
    ? {
        variants: [
          "\u{1F3FB}",
          "\u{1F3FC}",
          "\u{1F3FD}",
          "\u{1F3FE}",
          "\u{1F3FF}",
        ].map((modifier, index) => ({
          id: `tone-${index + 1}`,
          tone: index + 1,
          content: {
            type: "emoji",
            text: row[0] + modifier,
          },
        })),
      }
    : {}),
}));

var workspaceItems = [
  ...demoItems.filter(
    (item) => item.category === "frequent" || item.category === "smileys",
  ),
  {
    id: "orbit",
    label: "Orbit",
    content: {
      type: "image",
      src: orbit,
    },
    category: "objects",
    categories: ["custom"],
    shortcodes: ["orbit"],
    accent: "#8c78ea",
  },
  ...demoItems.filter((item) => item.category === "objects"),
];

```

### Alignment and grouping

Alignment is independent of actor and appearance. Direct grid bodies use horizontal self-alignment to place their fit-content surface; bodies inside MessageContent align across its column. Conversation derives self and remote placement only from supplied current-user and roster facts. Marker owns centered transcript boundaries.

message-alignment-and-grouping-8.jsx

```jsx
import { Marker } from "@/components/ui/marker";
import {
  Message as Message3,
  MessageBody as MessageBody3,
} from "@/components/ui/message";

export default function Example() {
  return (
    <div data-preview-wide>
      <Message3 actor="user" self={false} align="start" senderId="marta">
        <MessageBody3>Marta will confirm the retry check.</MessageBody3>
      </Message3>
      <Message3 actor="assistant" align="start" senderId="launch-analyst">
        <MessageBody3>The retry fix is merged.</MessageBody3>
      </Message3>
      <Marker variant="separator">Today</Marker>
      <Message3 actor="user" align="end">
        <MessageBody3>I’ll take the support handoff.</MessageBody3>
      </Message3>
    </div>
  );
}

var orbit =
  "data:image/svg+xml," +
  encodeURIComponent(
    '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><rect x="1" y="1" width="30" height="30" rx="10" fill="#8C78EA"/><path d="M16 6l3 7 7 3-7 3-3 7-3-7-7-3 7-3z" fill="white"/></svg>',
  );

var rows = [
  ["\u{1F50E}", "Magnifying glass", "frequent", "mag", "#8aaab7"],
  ["\u{1F9E0}", "Brain", "frequent", "brain", "#d879a6"],
  ["\u2728", "Sparkles", "frequent", "sparkles", "#e5b832"],
  ["\u{1F916}", "Robot", "frequent", "robot", "#6aa3bb"],
  ["\u{1F4DA}", "Books", "frequent", "books", "#4caa75"],
  ["\u{1F4A1}", "Light bulb", "frequent", "bulb", "#e9bd38"],
  ["\u{1F52C}", "Microscope", "frequent", "microscope", "#6c9cac"],
  ["\u{1F680}", "Rocket", "frequent", "rocket", "#ec6f50"],
  ["\u{1F600}", "Grinning face", "smileys", "grinning"],
  ["\u{1F60A}", "Smiling face", "smileys", "blush"],
  ["\u{1F602}", "Tears of joy", "smileys", "joy"],
  ["\u{1F979}", "Holding back tears", "smileys", "holding_back_tears"],
  ["\u{1F60D}", "Heart eyes", "smileys", "heart_eyes"],
  ["\u{1F914}", "Thinking face", "smileys", "thinking"],
  ["\u{1F60E}", "Sunglasses", "smileys", "sunglasses"],
  ["\u{1F973}", "Partying face", "smileys", "partying_face"],
  ["\u{1F917}", "Hugging face", "smileys", "hugs"],
  ["\u{1F60C}", "Relieved face", "smileys", "relieved"],
  ["\u{1F929}", "Star eyes", "smileys", "star_struck"],
  ["\u{1F605}", "Grinning with sweat", "smileys", "sweat_smile"],
  ["\u{1F44B}", "Waving hand", "smileys", "wave"],
  ["\u{1F44D}", "Thumbs up", "smileys", "+1"],
  ["\u{1F64F}", "Folded hands", "smileys", "pray"],
  ["\u{1F4AA}", "Flexed biceps", "smileys", "muscle"],
  ["\u{1F3A8}", "Artist palette", "objects", "art"],
  ["\u{1F4DD}", "Memo", "objects", "memo"],
  ["\u{1F310}", "Globe", "objects", "globe_with_meridians"],
  ["\u{1F4CA}", "Bar chart", "objects", "bar_chart"],
  ["\u{1F4AC}", "Speech balloon", "objects", "speech_balloon"],
  ["\u2B50", "Star", "objects", "star"],
  ["\u{1F3AF}", "Direct hit", "objects", "dart"],
  ["\u2764\uFE0F", "Red heart", "reactions", "heart", "#e75b52"],
  ["\u{1F389}", "Party popper", "reactions", "tada", "#e5b832"],
  ["\u{1F440}", "Eyes", "reactions", "eyes"],
];

var demoItems = rows.map((row) => ({
  id: row[3],
  label: row[1],
  content: {
    type: "emoji",
    text: row[0],
  },
  category: row[2],
  shortcodes: [row[3]],
  keywords: [
    row[1],
    row[3].replaceAll("_", " "),
    ...(row[3] === "microscope" ? ["science", "research"] : []),
  ],
  accent:
    row.length > 4 ? row[4] : row[2] === "smileys" ? "#e7b52b" : undefined,
  ...(["wave", "+1", "pray", "muscle"].includes(row[3])
    ? {
        variants: [
          "\u{1F3FB}",
          "\u{1F3FC}",
          "\u{1F3FD}",
          "\u{1F3FE}",
          "\u{1F3FF}",
        ].map((modifier, index) => ({
          id: `tone-${index + 1}`,
          tone: index + 1,
          content: {
            type: "emoji",
            text: row[0] + modifier,
          },
        })),
      }
    : {}),
}));

var workspaceItems = [
  ...demoItems.filter(
    (item) => item.category === "frequent" || item.category === "smileys",
  ),
  {
    id: "orbit",
    label: "Orbit",
    content: {
      type: "image",
      src: orbit,
    },
    category: "objects",
    categories: ["custom"],
    shortcodes: ["orbit"],
    accent: "#8c78ea",
  },
  ...demoItems.filter((item) => item.category === "objects"),
];

```

#### Same-sender grouping

MessageGroup groups adjacent direct Message children when actor, stable sender ID, and effective alignment match. Conversation owns grouping from stable message identity and history.

message-same-sender-grouping-9.jsx

```jsx
import { Avatar } from "@/components/ui/avatar";
import {
  Message as Message3,
  MessageAvatar,
  MessageBody as MessageBody3,
  MessageContent as MessageContent2,
  MessageGroup,
  MessageHeader,
} from "@/components/ui/message";

export default function Example() {
  return (
    <MessageGroup>
      <Message3 actor="user" self={false} senderId="marta" align="start">
        <MessageAvatar>
          <Avatar name="Marta" initials="M" kind="human" aria-hidden="true" />
        </MessageAvatar>
        <MessageContent2>
          <MessageHeader>Marta</MessageHeader>
          <MessageBody3>The staged release is ready.</MessageBody3>
        </MessageContent2>
      </Message3>
      <Message3 actor="user" self={false} senderId="marta" align="start">
        <MessageBody3>The retry fix is merged.</MessageBody3>
      </Message3>
      <Message3 actor="user" self={false} senderId="marta" align="start">
        <MessageBody3>I’ll watch the first cohort after release.</MessageBody3>
      </Message3>
    </MessageGroup>
  );
}

var orbit =
  "data:image/svg+xml," +
  encodeURIComponent(
    '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><rect x="1" y="1" width="30" height="30" rx="10" fill="#8C78EA"/><path d="M16 6l3 7 7 3-7 3-3 7-3-7-7-3 7-3z" fill="white"/></svg>',
  );

var rows = [
  ["\u{1F50E}", "Magnifying glass", "frequent", "mag", "#8aaab7"],
  ["\u{1F9E0}", "Brain", "frequent", "brain", "#d879a6"],
  ["\u2728", "Sparkles", "frequent", "sparkles", "#e5b832"],
  ["\u{1F916}", "Robot", "frequent", "robot", "#6aa3bb"],
  ["\u{1F4DA}", "Books", "frequent", "books", "#4caa75"],
  ["\u{1F4A1}", "Light bulb", "frequent", "bulb", "#e9bd38"],
  ["\u{1F52C}", "Microscope", "frequent", "microscope", "#6c9cac"],
  ["\u{1F680}", "Rocket", "frequent", "rocket", "#ec6f50"],
  ["\u{1F600}", "Grinning face", "smileys", "grinning"],
  ["\u{1F60A}", "Smiling face", "smileys", "blush"],
  ["\u{1F602}", "Tears of joy", "smileys", "joy"],
  ["\u{1F979}", "Holding back tears", "smileys", "holding_back_tears"],
  ["\u{1F60D}", "Heart eyes", "smileys", "heart_eyes"],
  ["\u{1F914}", "Thinking face", "smileys", "thinking"],
  ["\u{1F60E}", "Sunglasses", "smileys", "sunglasses"],
  ["\u{1F973}", "Partying face", "smileys", "partying_face"],
  ["\u{1F917}", "Hugging face", "smileys", "hugs"],
  ["\u{1F60C}", "Relieved face", "smileys", "relieved"],
  ["\u{1F929}", "Star eyes", "smileys", "star_struck"],
  ["\u{1F605}", "Grinning with sweat", "smileys", "sweat_smile"],
  ["\u{1F44B}", "Waving hand", "smileys", "wave"],
  ["\u{1F44D}", "Thumbs up", "smileys", "+1"],
  ["\u{1F64F}", "Folded hands", "smileys", "pray"],
  ["\u{1F4AA}", "Flexed biceps", "smileys", "muscle"],
  ["\u{1F3A8}", "Artist palette", "objects", "art"],
  ["\u{1F4DD}", "Memo", "objects", "memo"],
  ["\u{1F310}", "Globe", "objects", "globe_with_meridians"],
  ["\u{1F4CA}", "Bar chart", "objects", "bar_chart"],
  ["\u{1F4AC}", "Speech balloon", "objects", "speech_balloon"],
  ["\u2B50", "Star", "objects", "star"],
  ["\u{1F3AF}", "Direct hit", "objects", "dart"],
  ["\u2764\uFE0F", "Red heart", "reactions", "heart", "#e75b52"],
  ["\u{1F389}", "Party popper", "reactions", "tada", "#e5b832"],
  ["\u{1F440}", "Eyes", "reactions", "eyes"],
];

var demoItems = rows.map((row) => ({
  id: row[3],
  label: row[1],
  content: {
    type: "emoji",
    text: row[0],
  },
  category: row[2],
  shortcodes: [row[3]],
  keywords: [
    row[1],
    row[3].replaceAll("_", " "),
    ...(row[3] === "microscope" ? ["science", "research"] : []),
  ],
  accent:
    row.length > 4 ? row[4] : row[2] === "smileys" ? "#e7b52b" : undefined,
  ...(["wave", "+1", "pray", "muscle"].includes(row[3])
    ? {
        variants: [
          "\u{1F3FB}",
          "\u{1F3FC}",
          "\u{1F3FD}",
          "\u{1F3FE}",
          "\u{1F3FF}",
        ].map((modifier, index) => ({
          id: `tone-${index + 1}`,
          tone: index + 1,
          content: {
            type: "emoji",
            text: row[0] + modifier,
          },
        })),
      }
    : {}),
}));

var workspaceItems = [
  ...demoItems.filter(
    (item) => item.category === "frequent" || item.category === "smileys",
  ),
  {
    id: "orbit",
    label: "Orbit",
    content: {
      type: "image",
      src: orbit,
    },
    category: "objects",
    categories: ["custom"],
    shortcodes: ["orbit"],
    accent: "#8c78ea",
  },
  ...demoItems.filter((item) => item.category === "objects"),
];

```

### Content

Message composes content in order; Attachment, Citation, AudioPlayer, Transcript, and reply content retain their own semantics. Bubbles, attachment cards and +N tiles each keep the independent 12px theme baseline across all senders, including bubble-less agent messages. Only the cover inside an attachment derives inward: 11px after a 1px border for full-bleed media, or 3px after 8px padding and a 1px border for padded previews. Bubbles use uniform padding.

#### File and copy action

The message owns its file placement. MessageActions owns Copy and its feedback.

message-file-and-copy-action-10.jsx

```jsx
import { MessageParts } from "@/components/ui/message-parts";
import { Avatar } from "@/components/ui/avatar";
import { MessageActions as MessageActions2 } from "@/components/ui/message-actions";
import {
  Message as Message3,
  MessageAvatar,
  MessageBody as MessageBody3,
  MessageContent as MessageContent2,
  MessageFooter as MessageFooter2,
  MessageHeader,
  MessageMeta as MessageMeta2,
} from "@/components/ui/message";

export default function Example() {
  const files = [
    "launch-review.pdf",
    "owner-checklist.pdf",
    "staging-notes.txt",
    "support-handoff.md",
  ].map((name, index) => ({
    type: "file",
    id: `pack-${index}`,
    name,
    mediaType: "application/pdf",
    size: 245760,
    status: "ready",
  }));
  return (
    <div
      data-preview-wide
      style={{
        display: "grid",
        gap: "var(--space-4)",
      }}
    >
      <Message3 actor="user">
        <MessageContent2>
          <MessageBody3>
            <MessageParts
              parts={[
                {
                  type: "text",
                  id: "request",
                  text: "Can you check the owners in this rollout plan?",
                },
                ...files,
              ]}
            />
          </MessageBody3>
          <MessageFooter2>
            <MessageMeta2>
              <time dateTime="2026-11-09T09:42:00+07:00">9:42 AM</time>
            </MessageMeta2>
          </MessageFooter2>
        </MessageContent2>
      </Message3>
      <Message3 actor="user" self={false} senderId="marta">
        <MessageAvatar>
          <Avatar
            name="Marta Chen"
            kind="human"
            seed="marta"
            aria-hidden="true"
          />
        </MessageAvatar>
        <MessageContent2>
          <MessageHeader>Marta Chen</MessageHeader>
          <MessageBody3>
            <MessageParts
              parts={[
                {
                  type: "text",
                  id: "remote-file-text",
                  text: "The signed rollout plan is ready.",
                },
                {
                  type: "file",
                  id: "remote-plan",
                  name: "signed-rollout-plan.pdf",
                  mediaType: "application/pdf",
                  size: 245760,
                  status: "ready",
                },
              ]}
            />
          </MessageBody3>
          <MessageFooter2>
            <MessageActions2 text="The signed rollout plan is ready." />
          </MessageFooter2>
        </MessageContent2>
      </Message3>
      <Message3 actor="assistant" senderId="launch-analyst">
        <MessageAvatar>
          <Avatar
            name="Launch analyst"
            kind="agent"
            seed="launch-analyst"
            aria-hidden="true"
          />
        </MessageAvatar>
        <MessageContent2>
          <MessageHeader>Launch analyst</MessageHeader>
          <MessageBody3>
            <MessageParts
              parts={[
                {
                  type: "text",
                  id: "agent-file-text",
                  text: "The evidence pack is ready.",
                },
                {
                  type: "file",
                  id: "agent-runbook",
                  name: "release-runbook.md",
                  mediaType: "text/plain",
                  size: 8192,
                  status: "ready",
                },
              ]}
            />
          </MessageBody3>
        </MessageContent2>
      </Message3>
    </div>
  );
}

var orbit =
  "data:image/svg+xml," +
  encodeURIComponent(
    '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><rect x="1" y="1" width="30" height="30" rx="10" fill="#8C78EA"/><path d="M16 6l3 7 7 3-7 3-3 7-3-7-7-3 7-3z" fill="white"/></svg>',
  );

var rows = [
  ["\u{1F50E}", "Magnifying glass", "frequent", "mag", "#8aaab7"],
  ["\u{1F9E0}", "Brain", "frequent", "brain", "#d879a6"],
  ["\u2728", "Sparkles", "frequent", "sparkles", "#e5b832"],
  ["\u{1F916}", "Robot", "frequent", "robot", "#6aa3bb"],
  ["\u{1F4DA}", "Books", "frequent", "books", "#4caa75"],
  ["\u{1F4A1}", "Light bulb", "frequent", "bulb", "#e9bd38"],
  ["\u{1F52C}", "Microscope", "frequent", "microscope", "#6c9cac"],
  ["\u{1F680}", "Rocket", "frequent", "rocket", "#ec6f50"],
  ["\u{1F600}", "Grinning face", "smileys", "grinning"],
  ["\u{1F60A}", "Smiling face", "smileys", "blush"],
  ["\u{1F602}", "Tears of joy", "smileys", "joy"],
  ["\u{1F979}", "Holding back tears", "smileys", "holding_back_tears"],
  ["\u{1F60D}", "Heart eyes", "smileys", "heart_eyes"],
  ["\u{1F914}", "Thinking face", "smileys", "thinking"],
  ["\u{1F60E}", "Sunglasses", "smileys", "sunglasses"],
  ["\u{1F973}", "Partying face", "smileys", "partying_face"],
  ["\u{1F917}", "Hugging face", "smileys", "hugs"],
  ["\u{1F60C}", "Relieved face", "smileys", "relieved"],
  ["\u{1F929}", "Star eyes", "smileys", "star_struck"],
  ["\u{1F605}", "Grinning with sweat", "smileys", "sweat_smile"],
  ["\u{1F44B}", "Waving hand", "smileys", "wave"],
  ["\u{1F44D}", "Thumbs up", "smileys", "+1"],
  ["\u{1F64F}", "Folded hands", "smileys", "pray"],
  ["\u{1F4AA}", "Flexed biceps", "smileys", "muscle"],
  ["\u{1F3A8}", "Artist palette", "objects", "art"],
  ["\u{1F4DD}", "Memo", "objects", "memo"],
  ["\u{1F310}", "Globe", "objects", "globe_with_meridians"],
  ["\u{1F4CA}", "Bar chart", "objects", "bar_chart"],
  ["\u{1F4AC}", "Speech balloon", "objects", "speech_balloon"],
  ["\u2B50", "Star", "objects", "star"],
  ["\u{1F3AF}", "Direct hit", "objects", "dart"],
  ["\u2764\uFE0F", "Red heart", "reactions", "heart", "#e75b52"],
  ["\u{1F389}", "Party popper", "reactions", "tada", "#e5b832"],
  ["\u{1F440}", "Eyes", "reactions", "eyes"],
];

var demoItems = rows.map((row) => ({
  id: row[3],
  label: row[1],
  content: {
    type: "emoji",
    text: row[0],
  },
  category: row[2],
  shortcodes: [row[3]],
  keywords: [
    row[1],
    row[3].replaceAll("_", " "),
    ...(row[3] === "microscope" ? ["science", "research"] : []),
  ],
  accent:
    row.length > 4 ? row[4] : row[2] === "smileys" ? "#e7b52b" : undefined,
  ...(["wave", "+1", "pray", "muscle"].includes(row[3])
    ? {
        variants: [
          "\u{1F3FB}",
          "\u{1F3FC}",
          "\u{1F3FD}",
          "\u{1F3FE}",
          "\u{1F3FF}",
        ].map((modifier, index) => ({
          id: `tone-${index + 1}`,
          tone: index + 1,
          content: {
            type: "emoji",
            text: row[0] + modifier,
          },
        })),
      }
    : {}),
}));

var workspaceItems = [
  ...demoItems.filter(
    (item) => item.category === "frequent" || item.category === "smileys",
  ),
  {
    id: "orbit",
    label: "Orbit",
    content: {
      type: "image",
      src: orbit,
    },
    category: "objects",
    categories: ["custom"],
    shortcodes: ["orbit"],
    accent: "#8c78ea",
  },
  ...demoItems.filter((item) => item.category === "objects"),
];

```

#### Mixed image and document files

message-mixed-image-and-document-files-11.jsx

```jsx
import { MessageParts } from "@/components/ui/message-parts";
import { Avatar } from "@/components/ui/avatar";
import { useSyncExternalStore } from "react";
import {
  Message as Message3,
  MessageAvatar,
  MessageBody as MessageBody3,
  MessageContent as MessageContent2,
  MessageHeader,
} from "@/components/ui/message";

export default function Example() {
  const workspacePhotoUrl = useDemoAssetUrl("/attachments/workspace.jpg");
  const files = [
    {
      type: "file",
      id: "mixed-photo",
      name: "staging-photo.jpg",
      mediaType: "image/jpeg",
      size: 438272,
      url: workspacePhotoUrl,
      status: "ready",
    },
    {
      type: "file",
      id: "mixed-plan",
      name: "rollout-plan.pdf",
      mediaType: "application/pdf",
      size: 245760,
      status: "ready",
    },
    {
      type: "file",
      id: "mixed-checklist",
      name: "owner-checklist.pdf",
      mediaType: "application/pdf",
      size: 122880,
      status: "ready",
    },
    {
      type: "file",
      id: "mixed-notes",
      name: "staging-notes.txt",
      mediaType: "text/plain",
      size: 8192,
      status: "ready",
    },
  ];
  return (
    <ContentSenderRows>
      <MessageParts
        parts={[
          {
            type: "text",
            id: "mixed-content",
            text: "Here is the launch review pack.",
          },
          ...files,
        ]}
      />
    </ContentSenderRows>
  );
}

var orbit =
  "data:image/svg+xml," +
  encodeURIComponent(
    '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><rect x="1" y="1" width="30" height="30" rx="10" fill="#8C78EA"/><path d="M16 6l3 7 7 3-7 3-3 7-3-7-7-3 7-3z" fill="white"/></svg>',
  );

var rows = [
  ["\u{1F50E}", "Magnifying glass", "frequent", "mag", "#8aaab7"],
  ["\u{1F9E0}", "Brain", "frequent", "brain", "#d879a6"],
  ["\u2728", "Sparkles", "frequent", "sparkles", "#e5b832"],
  ["\u{1F916}", "Robot", "frequent", "robot", "#6aa3bb"],
  ["\u{1F4DA}", "Books", "frequent", "books", "#4caa75"],
  ["\u{1F4A1}", "Light bulb", "frequent", "bulb", "#e9bd38"],
  ["\u{1F52C}", "Microscope", "frequent", "microscope", "#6c9cac"],
  ["\u{1F680}", "Rocket", "frequent", "rocket", "#ec6f50"],
  ["\u{1F600}", "Grinning face", "smileys", "grinning"],
  ["\u{1F60A}", "Smiling face", "smileys", "blush"],
  ["\u{1F602}", "Tears of joy", "smileys", "joy"],
  ["\u{1F979}", "Holding back tears", "smileys", "holding_back_tears"],
  ["\u{1F60D}", "Heart eyes", "smileys", "heart_eyes"],
  ["\u{1F914}", "Thinking face", "smileys", "thinking"],
  ["\u{1F60E}", "Sunglasses", "smileys", "sunglasses"],
  ["\u{1F973}", "Partying face", "smileys", "partying_face"],
  ["\u{1F917}", "Hugging face", "smileys", "hugs"],
  ["\u{1F60C}", "Relieved face", "smileys", "relieved"],
  ["\u{1F929}", "Star eyes", "smileys", "star_struck"],
  ["\u{1F605}", "Grinning with sweat", "smileys", "sweat_smile"],
  ["\u{1F44B}", "Waving hand", "smileys", "wave"],
  ["\u{1F44D}", "Thumbs up", "smileys", "+1"],
  ["\u{1F64F}", "Folded hands", "smileys", "pray"],
  ["\u{1F4AA}", "Flexed biceps", "smileys", "muscle"],
  ["\u{1F3A8}", "Artist palette", "objects", "art"],
  ["\u{1F4DD}", "Memo", "objects", "memo"],
  ["\u{1F310}", "Globe", "objects", "globe_with_meridians"],
  ["\u{1F4CA}", "Bar chart", "objects", "bar_chart"],
  ["\u{1F4AC}", "Speech balloon", "objects", "speech_balloon"],
  ["\u2B50", "Star", "objects", "star"],
  ["\u{1F3AF}", "Direct hit", "objects", "dart"],
  ["\u2764\uFE0F", "Red heart", "reactions", "heart", "#e75b52"],
  ["\u{1F389}", "Party popper", "reactions", "tada", "#e5b832"],
  ["\u{1F440}", "Eyes", "reactions", "eyes"],
];

var demoItems = rows.map((row) => ({
  id: row[3],
  label: row[1],
  content: {
    type: "emoji",
    text: row[0],
  },
  category: row[2],
  shortcodes: [row[3]],
  keywords: [
    row[1],
    row[3].replaceAll("_", " "),
    ...(row[3] === "microscope" ? ["science", "research"] : []),
  ],
  accent:
    row.length > 4 ? row[4] : row[2] === "smileys" ? "#e7b52b" : undefined,
  ...(["wave", "+1", "pray", "muscle"].includes(row[3])
    ? {
        variants: [
          "\u{1F3FB}",
          "\u{1F3FC}",
          "\u{1F3FD}",
          "\u{1F3FE}",
          "\u{1F3FF}",
        ].map((modifier, index) => ({
          id: `tone-${index + 1}`,
          tone: index + 1,
          content: {
            type: "emoji",
            text: row[0] + modifier,
          },
        })),
      }
    : {}),
}));

var workspaceItems = [
  ...demoItems.filter(
    (item) => item.category === "frequent" || item.category === "smileys",
  ),
  {
    id: "orbit",
    label: "Orbit",
    content: {
      type: "image",
      src: orbit,
    },
    category: "objects",
    categories: ["custom"],
    shortcodes: ["orbit"],
    accent: "#8c78ea",
  },
  ...demoItems.filter((item) => item.category === "objects"),
];

var subscribe = () => () => {};

var serverOrigin = () => "";

var browserOrigin = () => window.location.origin;

function useDemoAssetUrl(path) {
  const origin = useSyncExternalStore(subscribe, browserOrigin, serverOrigin);
  return origin ? new URL(path, origin).href : undefined;
}

function ContentSenderRows({ children }) {
  return (
    <div
      data-preview-wide
      style={{
        display: "grid",
        gap: "var(--space-4)",
      }}
    >
      <Message3 actor="user" senderId="rina">
        <MessageContent2>
          <MessageBody3>{children}</MessageBody3>
        </MessageContent2>
      </Message3>
      <Message3 actor="user" self={false} senderId="marta">
        <MessageAvatar>
          <Avatar
            name="Marta Chen"
            kind="human"
            seed="marta"
            aria-hidden="true"
          />
        </MessageAvatar>
        <MessageContent2>
          <MessageHeader>Marta Chen</MessageHeader>
          <MessageBody3>{children}</MessageBody3>
        </MessageContent2>
      </Message3>
      <Message3 actor="assistant" senderId="launch-analyst">
        <MessageAvatar>
          <Avatar
            name="Launch analyst"
            kind="agent"
            seed="launch-analyst"
            aria-hidden="true"
          />
        </MessageAvatar>
        <MessageContent2>
          <MessageHeader>Launch analyst</MessageHeader>
          <MessageBody3>{children}</MessageBody3>
        </MessageContent2>
      </Message3>
    </div>
  );
}

```

#### File count and overflow

Adjacent files keep their source order. One ready file uses the larger preview; two and three use compact tiles; four or more show two tiles and a +N disclosure. Uploading and failed files remain full rows with their own recovery.

message-file-count-and-overflow-12.jsx

```jsx
import { MessageParts } from "@/components/ui/message-parts";
import { useSyncExternalStore } from "react";
import {
  Message as Message3,
  MessageBody as MessageBody3,
  MessageContent as MessageContent2,
} from "@/components/ui/message";

export default function Example() {
  const workspacePhotoUrl = useDemoAssetUrl("/attachments/workspace.jpg");
  const files = [
    {
      type: "file",
      id: "count-photo",
      name: "workspace.jpg",
      mediaType: "image/jpeg",
      size: 438272,
      url: workspacePhotoUrl,
      status: "ready",
    },
    {
      type: "file",
      id: "count-plan",
      name: "rollout-plan.pdf",
      mediaType: "application/pdf",
      size: 245760,
      status: "ready",
    },
    {
      type: "file",
      id: "count-checklist",
      name: "owner-checklist.pdf",
      mediaType: "application/pdf",
      size: 122880,
      status: "ready",
    },
    {
      type: "file",
      id: "count-notes",
      name: "staging-notes.txt",
      mediaType: "text/plain",
      size: 8192,
      status: "ready",
    },
  ];
  return (
    <div
      data-preview-wide
      style={{
        display: "grid",
        gap: "var(--space-3)",
      }}
    >
      {[1, 2, 3, 4].map((count) => (
        <Message3 actor="user" key={count}>
          <MessageContent2>
            <MessageBody3>
              <MessageParts
                parts={[
                  {
                    type: "text",
                    id: `count-label-${count}`,
                    text: [
                      "Could you review this photo before the launch?",
                      "The photo and release plan are ready for handoff.",
                      "I\u2019m adding the owner checklist for today\u2019s rollout.",
                      "Here\u2019s the full launch review pack.",
                    ][count - 1],
                  },
                  ...files.slice(0, count),
                ]}
              />
            </MessageBody3>
          </MessageContent2>
        </Message3>
      ))}
    </div>
  );
}

var orbit =
  "data:image/svg+xml," +
  encodeURIComponent(
    '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><rect x="1" y="1" width="30" height="30" rx="10" fill="#8C78EA"/><path d="M16 6l3 7 7 3-7 3-3 7-3-7-7-3 7-3z" fill="white"/></svg>',
  );

var rows = [
  ["\u{1F50E}", "Magnifying glass", "frequent", "mag", "#8aaab7"],
  ["\u{1F9E0}", "Brain", "frequent", "brain", "#d879a6"],
  ["\u2728", "Sparkles", "frequent", "sparkles", "#e5b832"],
  ["\u{1F916}", "Robot", "frequent", "robot", "#6aa3bb"],
  ["\u{1F4DA}", "Books", "frequent", "books", "#4caa75"],
  ["\u{1F4A1}", "Light bulb", "frequent", "bulb", "#e9bd38"],
  ["\u{1F52C}", "Microscope", "frequent", "microscope", "#6c9cac"],
  ["\u{1F680}", "Rocket", "frequent", "rocket", "#ec6f50"],
  ["\u{1F600}", "Grinning face", "smileys", "grinning"],
  ["\u{1F60A}", "Smiling face", "smileys", "blush"],
  ["\u{1F602}", "Tears of joy", "smileys", "joy"],
  ["\u{1F979}", "Holding back tears", "smileys", "holding_back_tears"],
  ["\u{1F60D}", "Heart eyes", "smileys", "heart_eyes"],
  ["\u{1F914}", "Thinking face", "smileys", "thinking"],
  ["\u{1F60E}", "Sunglasses", "smileys", "sunglasses"],
  ["\u{1F973}", "Partying face", "smileys", "partying_face"],
  ["\u{1F917}", "Hugging face", "smileys", "hugs"],
  ["\u{1F60C}", "Relieved face", "smileys", "relieved"],
  ["\u{1F929}", "Star eyes", "smileys", "star_struck"],
  ["\u{1F605}", "Grinning with sweat", "smileys", "sweat_smile"],
  ["\u{1F44B}", "Waving hand", "smileys", "wave"],
  ["\u{1F44D}", "Thumbs up", "smileys", "+1"],
  ["\u{1F64F}", "Folded hands", "smileys", "pray"],
  ["\u{1F4AA}", "Flexed biceps", "smileys", "muscle"],
  ["\u{1F3A8}", "Artist palette", "objects", "art"],
  ["\u{1F4DD}", "Memo", "objects", "memo"],
  ["\u{1F310}", "Globe", "objects", "globe_with_meridians"],
  ["\u{1F4CA}", "Bar chart", "objects", "bar_chart"],
  ["\u{1F4AC}", "Speech balloon", "objects", "speech_balloon"],
  ["\u2B50", "Star", "objects", "star"],
  ["\u{1F3AF}", "Direct hit", "objects", "dart"],
  ["\u2764\uFE0F", "Red heart", "reactions", "heart", "#e75b52"],
  ["\u{1F389}", "Party popper", "reactions", "tada", "#e5b832"],
  ["\u{1F440}", "Eyes", "reactions", "eyes"],
];

var demoItems = rows.map((row) => ({
  id: row[3],
  label: row[1],
  content: {
    type: "emoji",
    text: row[0],
  },
  category: row[2],
  shortcodes: [row[3]],
  keywords: [
    row[1],
    row[3].replaceAll("_", " "),
    ...(row[3] === "microscope" ? ["science", "research"] : []),
  ],
  accent:
    row.length > 4 ? row[4] : row[2] === "smileys" ? "#e7b52b" : undefined,
  ...(["wave", "+1", "pray", "muscle"].includes(row[3])
    ? {
        variants: [
          "\u{1F3FB}",
          "\u{1F3FC}",
          "\u{1F3FD}",
          "\u{1F3FE}",
          "\u{1F3FF}",
        ].map((modifier, index) => ({
          id: `tone-${index + 1}`,
          tone: index + 1,
          content: {
            type: "emoji",
            text: row[0] + modifier,
          },
        })),
      }
    : {}),
}));

var workspaceItems = [
  ...demoItems.filter(
    (item) => item.category === "frequent" || item.category === "smileys",
  ),
  {
    id: "orbit",
    label: "Orbit",
    content: {
      type: "image",
      src: orbit,
    },
    category: "objects",
    categories: ["custom"],
    shortcodes: ["orbit"],
    accent: "#8c78ea",
  },
  ...demoItems.filter((item) => item.category === "objects"),
];

var subscribe = () => () => {};

var serverOrigin = () => "";

var browserOrigin = () => window.location.origin;

function useDemoAssetUrl(path) {
  const origin = useSyncExternalStore(subscribe, browserOrigin, serverOrigin);
  return origin ? new URL(path, origin).href : undefined;
}

```

#### Image

message-image-13.jsx

```jsx
import { MessageParts } from "@/components/ui/message-parts";
import { Avatar } from "@/components/ui/avatar";
import { useSyncExternalStore } from "react";
import {
  Message as Message3,
  MessageAvatar,
  MessageBody as MessageBody3,
  MessageContent as MessageContent2,
  MessageHeader,
} from "@/components/ui/message";

export default function Example() {
  const workspacePhotoUrl = useDemoAssetUrl("/attachments/workspace.jpg");
  return (
    <ContentSenderRows>
      <MessageParts
        parts={[
          {
            type: "text",
            id: "image-caption",
            text: "The release checklist is ready for review.",
          },
          {
            type: "file",
            id: "workspace-photo",
            name: "workspace.jpg",
            mediaType: "image/jpeg",
            size: 438272,
            url: workspacePhotoUrl,
            status: "ready",
          },
        ]}
      />
    </ContentSenderRows>
  );
}

var orbit =
  "data:image/svg+xml," +
  encodeURIComponent(
    '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><rect x="1" y="1" width="30" height="30" rx="10" fill="#8C78EA"/><path d="M16 6l3 7 7 3-7 3-3 7-3-7-7-3 7-3z" fill="white"/></svg>',
  );

var rows = [
  ["\u{1F50E}", "Magnifying glass", "frequent", "mag", "#8aaab7"],
  ["\u{1F9E0}", "Brain", "frequent", "brain", "#d879a6"],
  ["\u2728", "Sparkles", "frequent", "sparkles", "#e5b832"],
  ["\u{1F916}", "Robot", "frequent", "robot", "#6aa3bb"],
  ["\u{1F4DA}", "Books", "frequent", "books", "#4caa75"],
  ["\u{1F4A1}", "Light bulb", "frequent", "bulb", "#e9bd38"],
  ["\u{1F52C}", "Microscope", "frequent", "microscope", "#6c9cac"],
  ["\u{1F680}", "Rocket", "frequent", "rocket", "#ec6f50"],
  ["\u{1F600}", "Grinning face", "smileys", "grinning"],
  ["\u{1F60A}", "Smiling face", "smileys", "blush"],
  ["\u{1F602}", "Tears of joy", "smileys", "joy"],
  ["\u{1F979}", "Holding back tears", "smileys", "holding_back_tears"],
  ["\u{1F60D}", "Heart eyes", "smileys", "heart_eyes"],
  ["\u{1F914}", "Thinking face", "smileys", "thinking"],
  ["\u{1F60E}", "Sunglasses", "smileys", "sunglasses"],
  ["\u{1F973}", "Partying face", "smileys", "partying_face"],
  ["\u{1F917}", "Hugging face", "smileys", "hugs"],
  ["\u{1F60C}", "Relieved face", "smileys", "relieved"],
  ["\u{1F929}", "Star eyes", "smileys", "star_struck"],
  ["\u{1F605}", "Grinning with sweat", "smileys", "sweat_smile"],
  ["\u{1F44B}", "Waving hand", "smileys", "wave"],
  ["\u{1F44D}", "Thumbs up", "smileys", "+1"],
  ["\u{1F64F}", "Folded hands", "smileys", "pray"],
  ["\u{1F4AA}", "Flexed biceps", "smileys", "muscle"],
  ["\u{1F3A8}", "Artist palette", "objects", "art"],
  ["\u{1F4DD}", "Memo", "objects", "memo"],
  ["\u{1F310}", "Globe", "objects", "globe_with_meridians"],
  ["\u{1F4CA}", "Bar chart", "objects", "bar_chart"],
  ["\u{1F4AC}", "Speech balloon", "objects", "speech_balloon"],
  ["\u2B50", "Star", "objects", "star"],
  ["\u{1F3AF}", "Direct hit", "objects", "dart"],
  ["\u2764\uFE0F", "Red heart", "reactions", "heart", "#e75b52"],
  ["\u{1F389}", "Party popper", "reactions", "tada", "#e5b832"],
  ["\u{1F440}", "Eyes", "reactions", "eyes"],
];

var demoItems = rows.map((row) => ({
  id: row[3],
  label: row[1],
  content: {
    type: "emoji",
    text: row[0],
  },
  category: row[2],
  shortcodes: [row[3]],
  keywords: [
    row[1],
    row[3].replaceAll("_", " "),
    ...(row[3] === "microscope" ? ["science", "research"] : []),
  ],
  accent:
    row.length > 4 ? row[4] : row[2] === "smileys" ? "#e7b52b" : undefined,
  ...(["wave", "+1", "pray", "muscle"].includes(row[3])
    ? {
        variants: [
          "\u{1F3FB}",
          "\u{1F3FC}",
          "\u{1F3FD}",
          "\u{1F3FE}",
          "\u{1F3FF}",
        ].map((modifier, index) => ({
          id: `tone-${index + 1}`,
          tone: index + 1,
          content: {
            type: "emoji",
            text: row[0] + modifier,
          },
        })),
      }
    : {}),
}));

var workspaceItems = [
  ...demoItems.filter(
    (item) => item.category === "frequent" || item.category === "smileys",
  ),
  {
    id: "orbit",
    label: "Orbit",
    content: {
      type: "image",
      src: orbit,
    },
    category: "objects",
    categories: ["custom"],
    shortcodes: ["orbit"],
    accent: "#8c78ea",
  },
  ...demoItems.filter((item) => item.category === "objects"),
];

var subscribe = () => () => {};

var serverOrigin = () => "";

var browserOrigin = () => window.location.origin;

function useDemoAssetUrl(path) {
  const origin = useSyncExternalStore(subscribe, browserOrigin, serverOrigin);
  return origin ? new URL(path, origin).href : undefined;
}

function ContentSenderRows({ children }) {
  return (
    <div
      data-preview-wide
      style={{
        display: "grid",
        gap: "var(--space-4)",
      }}
    >
      <Message3 actor="user" senderId="rina">
        <MessageContent2>
          <MessageBody3>{children}</MessageBody3>
        </MessageContent2>
      </Message3>
      <Message3 actor="user" self={false} senderId="marta">
        <MessageAvatar>
          <Avatar
            name="Marta Chen"
            kind="human"
            seed="marta"
            aria-hidden="true"
          />
        </MessageAvatar>
        <MessageContent2>
          <MessageHeader>Marta Chen</MessageHeader>
          <MessageBody3>{children}</MessageBody3>
        </MessageContent2>
      </Message3>
      <Message3 actor="assistant" senderId="launch-analyst">
        <MessageAvatar>
          <Avatar
            name="Launch analyst"
            kind="agent"
            seed="launch-analyst"
            aria-hidden="true"
          />
        </MessageAvatar>
        <MessageContent2>
          <MessageHeader>Launch analyst</MessageHeader>
          <MessageBody3>{children}</MessageBody3>
        </MessageContent2>
      </Message3>
    </div>
  );
}

```

#### Reply

message-reply-14.jsx

```jsx
import { Avatar } from "@/components/ui/avatar";
import {
  Message as Message3,
  MessageAvatar,
  MessageBody as MessageBody3,
  MessageContent as MessageContent2,
  MessageHeader,
} from "@/components/ui/message";

export default function Example() {
  return (
    <ContentSenderRows>
      <>
        <blockquote>
          <span>Marta Chen</span>
          <br />
          Can we start the first cohort before support is ready?
        </blockquote>
        <p>Keep the rollout on hold until Leon confirms the support handoff.</p>
      </>
    </ContentSenderRows>
  );
}

var orbit =
  "data:image/svg+xml," +
  encodeURIComponent(
    '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><rect x="1" y="1" width="30" height="30" rx="10" fill="#8C78EA"/><path d="M16 6l3 7 7 3-7 3-3 7-3-7-7-3 7-3z" fill="white"/></svg>',
  );

var rows = [
  ["\u{1F50E}", "Magnifying glass", "frequent", "mag", "#8aaab7"],
  ["\u{1F9E0}", "Brain", "frequent", "brain", "#d879a6"],
  ["\u2728", "Sparkles", "frequent", "sparkles", "#e5b832"],
  ["\u{1F916}", "Robot", "frequent", "robot", "#6aa3bb"],
  ["\u{1F4DA}", "Books", "frequent", "books", "#4caa75"],
  ["\u{1F4A1}", "Light bulb", "frequent", "bulb", "#e9bd38"],
  ["\u{1F52C}", "Microscope", "frequent", "microscope", "#6c9cac"],
  ["\u{1F680}", "Rocket", "frequent", "rocket", "#ec6f50"],
  ["\u{1F600}", "Grinning face", "smileys", "grinning"],
  ["\u{1F60A}", "Smiling face", "smileys", "blush"],
  ["\u{1F602}", "Tears of joy", "smileys", "joy"],
  ["\u{1F979}", "Holding back tears", "smileys", "holding_back_tears"],
  ["\u{1F60D}", "Heart eyes", "smileys", "heart_eyes"],
  ["\u{1F914}", "Thinking face", "smileys", "thinking"],
  ["\u{1F60E}", "Sunglasses", "smileys", "sunglasses"],
  ["\u{1F973}", "Partying face", "smileys", "partying_face"],
  ["\u{1F917}", "Hugging face", "smileys", "hugs"],
  ["\u{1F60C}", "Relieved face", "smileys", "relieved"],
  ["\u{1F929}", "Star eyes", "smileys", "star_struck"],
  ["\u{1F605}", "Grinning with sweat", "smileys", "sweat_smile"],
  ["\u{1F44B}", "Waving hand", "smileys", "wave"],
  ["\u{1F44D}", "Thumbs up", "smileys", "+1"],
  ["\u{1F64F}", "Folded hands", "smileys", "pray"],
  ["\u{1F4AA}", "Flexed biceps", "smileys", "muscle"],
  ["\u{1F3A8}", "Artist palette", "objects", "art"],
  ["\u{1F4DD}", "Memo", "objects", "memo"],
  ["\u{1F310}", "Globe", "objects", "globe_with_meridians"],
  ["\u{1F4CA}", "Bar chart", "objects", "bar_chart"],
  ["\u{1F4AC}", "Speech balloon", "objects", "speech_balloon"],
  ["\u2B50", "Star", "objects", "star"],
  ["\u{1F3AF}", "Direct hit", "objects", "dart"],
  ["\u2764\uFE0F", "Red heart", "reactions", "heart", "#e75b52"],
  ["\u{1F389}", "Party popper", "reactions", "tada", "#e5b832"],
  ["\u{1F440}", "Eyes", "reactions", "eyes"],
];

var demoItems = rows.map((row) => ({
  id: row[3],
  label: row[1],
  content: {
    type: "emoji",
    text: row[0],
  },
  category: row[2],
  shortcodes: [row[3]],
  keywords: [
    row[1],
    row[3].replaceAll("_", " "),
    ...(row[3] === "microscope" ? ["science", "research"] : []),
  ],
  accent:
    row.length > 4 ? row[4] : row[2] === "smileys" ? "#e7b52b" : undefined,
  ...(["wave", "+1", "pray", "muscle"].includes(row[3])
    ? {
        variants: [
          "\u{1F3FB}",
          "\u{1F3FC}",
          "\u{1F3FD}",
          "\u{1F3FE}",
          "\u{1F3FF}",
        ].map((modifier, index) => ({
          id: `tone-${index + 1}`,
          tone: index + 1,
          content: {
            type: "emoji",
            text: row[0] + modifier,
          },
        })),
      }
    : {}),
}));

var workspaceItems = [
  ...demoItems.filter(
    (item) => item.category === "frequent" || item.category === "smileys",
  ),
  {
    id: "orbit",
    label: "Orbit",
    content: {
      type: "image",
      src: orbit,
    },
    category: "objects",
    categories: ["custom"],
    shortcodes: ["orbit"],
    accent: "#8c78ea",
  },
  ...demoItems.filter((item) => item.category === "objects"),
];

function ContentSenderRows({ children }) {
  return (
    <div
      data-preview-wide
      style={{
        display: "grid",
        gap: "var(--space-4)",
      }}
    >
      <Message3 actor="user" senderId="rina">
        <MessageContent2>
          <MessageBody3>{children}</MessageBody3>
        </MessageContent2>
      </Message3>
      <Message3 actor="user" self={false} senderId="marta">
        <MessageAvatar>
          <Avatar
            name="Marta Chen"
            kind="human"
            seed="marta"
            aria-hidden="true"
          />
        </MessageAvatar>
        <MessageContent2>
          <MessageHeader>Marta Chen</MessageHeader>
          <MessageBody3>{children}</MessageBody3>
        </MessageContent2>
      </Message3>
      <Message3 actor="assistant" senderId="launch-analyst">
        <MessageAvatar>
          <Avatar
            name="Launch analyst"
            kind="agent"
            seed="launch-analyst"
            aria-hidden="true"
          />
        </MessageAvatar>
        <MessageContent2>
          <MessageHeader>Launch analyst</MessageHeader>
          <MessageBody3>{children}</MessageBody3>
        </MessageContent2>
      </Message3>
    </div>
  );
}

```

#### Long content

Long disclosure is opt-in. Clamp only the human text region; keep files, media, transcript, footer, and agent text visible. The essential Show more button uses 10px/14px text, a trailing chevron, and stays available on touch and keyboard.

message-long-content-15.jsx

```jsx
import { Avatar } from "@/components/ui/avatar";
import {
  Message as Message3,
  MessageAvatar,
  MessageBody as MessageBody3,
  MessageContent as MessageContent2,
  MessageFooter as MessageFooter2,
  MessageExpandButton,
  MessageHeader,
  MessageMeta as MessageMeta2,
} from "@/components/ui/message";

export default function Example() {
  const example = (actor, self, name, time) => (
    <Message3 actor={actor} self={self} key={name}>
      {!self && (
        <MessageAvatar>
          <Avatar
            name={name}
            kind={actor === "assistant" ? "agent" : "human"}
            seed={actor === "assistant" ? "gaze" : "dylan"}
            aria-hidden="true"
          />
        </MessageAvatar>
      )}
      <MessageContent2>
        {!self ? <MessageHeader>{name}</MessageHeader> : null}
        <MessageBody3>
          <MessageContent2 maxLines={actor === "user" ? 6 : undefined}>
            {
              "Staging passed the retry check this morning. Priya will confirm the deployment window by 15:00, and Marta will watch the first cohort after release. Leon is preparing a support reply with the rollback steps. The rollout stays on hold until all three owners confirm their handoff. The current checklist records each follow-up and the evidence needed before expanding the first cohort."
            }
          </MessageContent2>
          <MessageFooter2>
            {actor === "user" ? (
              <MessageMeta2>
                <time dateTime="2026-11-09T09:42:00+07:00">{time}</time>
              </MessageMeta2>
            ) : null}
            {actor === "user" ? <MessageExpandButton /> : null}
          </MessageFooter2>
        </MessageBody3>
      </MessageContent2>
    </Message3>
  );
  return (
    <div
      data-preview-wide
      style={{
        display: "grid",
        gap: "var(--space-4)",
      }}
    >
      {example("user", true, "You", "9:42 AM")}
      {example("user", false, "Marta Chen", "9:44 AM")}
      {example("assistant", false, "Launch analyst", "9:45 AM")}
    </div>
  );
}

var orbit =
  "data:image/svg+xml," +
  encodeURIComponent(
    '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><rect x="1" y="1" width="30" height="30" rx="10" fill="#8C78EA"/><path d="M16 6l3 7 7 3-7 3-3 7-3-7-7-3 7-3z" fill="white"/></svg>',
  );

var rows = [
  ["\u{1F50E}", "Magnifying glass", "frequent", "mag", "#8aaab7"],
  ["\u{1F9E0}", "Brain", "frequent", "brain", "#d879a6"],
  ["\u2728", "Sparkles", "frequent", "sparkles", "#e5b832"],
  ["\u{1F916}", "Robot", "frequent", "robot", "#6aa3bb"],
  ["\u{1F4DA}", "Books", "frequent", "books", "#4caa75"],
  ["\u{1F4A1}", "Light bulb", "frequent", "bulb", "#e9bd38"],
  ["\u{1F52C}", "Microscope", "frequent", "microscope", "#6c9cac"],
  ["\u{1F680}", "Rocket", "frequent", "rocket", "#ec6f50"],
  ["\u{1F600}", "Grinning face", "smileys", "grinning"],
  ["\u{1F60A}", "Smiling face", "smileys", "blush"],
  ["\u{1F602}", "Tears of joy", "smileys", "joy"],
  ["\u{1F979}", "Holding back tears", "smileys", "holding_back_tears"],
  ["\u{1F60D}", "Heart eyes", "smileys", "heart_eyes"],
  ["\u{1F914}", "Thinking face", "smileys", "thinking"],
  ["\u{1F60E}", "Sunglasses", "smileys", "sunglasses"],
  ["\u{1F973}", "Partying face", "smileys", "partying_face"],
  ["\u{1F917}", "Hugging face", "smileys", "hugs"],
  ["\u{1F60C}", "Relieved face", "smileys", "relieved"],
  ["\u{1F929}", "Star eyes", "smileys", "star_struck"],
  ["\u{1F605}", "Grinning with sweat", "smileys", "sweat_smile"],
  ["\u{1F44B}", "Waving hand", "smileys", "wave"],
  ["\u{1F44D}", "Thumbs up", "smileys", "+1"],
  ["\u{1F64F}", "Folded hands", "smileys", "pray"],
  ["\u{1F4AA}", "Flexed biceps", "smileys", "muscle"],
  ["\u{1F3A8}", "Artist palette", "objects", "art"],
  ["\u{1F4DD}", "Memo", "objects", "memo"],
  ["\u{1F310}", "Globe", "objects", "globe_with_meridians"],
  ["\u{1F4CA}", "Bar chart", "objects", "bar_chart"],
  ["\u{1F4AC}", "Speech balloon", "objects", "speech_balloon"],
  ["\u2B50", "Star", "objects", "star"],
  ["\u{1F3AF}", "Direct hit", "objects", "dart"],
  ["\u2764\uFE0F", "Red heart", "reactions", "heart", "#e75b52"],
  ["\u{1F389}", "Party popper", "reactions", "tada", "#e5b832"],
  ["\u{1F440}", "Eyes", "reactions", "eyes"],
];

var demoItems = rows.map((row) => ({
  id: row[3],
  label: row[1],
  content: {
    type: "emoji",
    text: row[0],
  },
  category: row[2],
  shortcodes: [row[3]],
  keywords: [
    row[1],
    row[3].replaceAll("_", " "),
    ...(row[3] === "microscope" ? ["science", "research"] : []),
  ],
  accent:
    row.length > 4 ? row[4] : row[2] === "smileys" ? "#e7b52b" : undefined,
  ...(["wave", "+1", "pray", "muscle"].includes(row[3])
    ? {
        variants: [
          "\u{1F3FB}",
          "\u{1F3FC}",
          "\u{1F3FD}",
          "\u{1F3FE}",
          "\u{1F3FF}",
        ].map((modifier, index) => ({
          id: `tone-${index + 1}`,
          tone: index + 1,
          content: {
            type: "emoji",
            text: row[0] + modifier,
          },
        })),
      }
    : {}),
}));

var workspaceItems = [
  ...demoItems.filter(
    (item) => item.category === "frequent" || item.category === "smileys",
  ),
  {
    id: "orbit",
    label: "Orbit",
    content: {
      type: "image",
      src: orbit,
    },
    category: "objects",
    categories: ["custom"],
    shortcodes: ["orbit"],
    accent: "#8c78ea",
  },
  ...demoItems.filter((item) => item.category === "objects"),
];

```

#### Voice and transcript

The player and transcript belong to the same voice content. Expanding uses a 4px gap between the disclosure and first transcript line. Transcript pending and transcript retry are content states; outgoing send retry belongs to MessageActions.

message-voice-and-transcript-16.jsx

```jsx
import { ChevronDown } from "lucide-react";
import { AudioPlayer, useAudioPlayer } from "@/components/ui/audio-player";
import { Button } from "@/components/ui/button";
import { Collapsible } from "@/components/ui/collapsible";
import { MessageBody } from "@/components/ui/message";
import { Transcript } from "@/components/ui/transcript";
import { Avatar } from "@/components/ui/avatar";
import {
  Message as Message3,
  MessageAvatar,
  MessageContent as MessageContent2,
  MessageHeader,
} from "@/components/ui/message";

export default function Example() {
  return (
    <div
      data-preview-wide
      style={{
        display: "grid",
        gap: "var(--space-4)",
      }}
    >
      <Message3 actor="user">
        <MessageContent2>
          <VoiceMessageContent />
        </MessageContent2>
      </Message3>
      <Message3 actor="user" self={false} senderId="marta">
        <MessageAvatar>
          <Avatar
            name="Marta Chen"
            kind="human"
            seed="marta"
            aria-hidden="true"
          />
        </MessageAvatar>
        <MessageContent2>
          <MessageHeader>Marta Chen</MessageHeader>
          <VoiceMessageContent />
        </MessageContent2>
      </Message3>
      <Message3 actor="assistant" senderId="launch-analyst">
        <MessageAvatar>
          <Avatar
            name="Launch analyst"
            kind="agent"
            seed="launch-analyst"
            aria-hidden="true"
          />
        </MessageAvatar>
        <MessageContent2>
          <MessageHeader>Launch analyst</MessageHeader>
          <VoiceMessageContent />
        </MessageContent2>
      </Message3>
    </div>
  );
}

function RecordedTranscript() {
  const player = useAudioPlayer();
  return (
    <Transcript
      segments={[
        {
          id: "response",
          text: "\u201CThe Metal Forest is in the Great Domed Cavern, the largest in all our dominions,\u201D replied Kaliko.",
          start: 0,
          end: player.duration || undefined,
          status: "final",
        },
      ]}
    />
  );
}

function VoiceMessageContent({
  transcriptStatus = "ready",
  onRetryTranscript,
  delivery = "complete",
  onRetryDelivery,
}) {
  return (
    <MessageBody>
      <AudioPlayer.Root src={"/audio/the-metal-forest.mp3"} label="Voice note">
        <AudioPlayer.ControlBar>
          <AudioPlayer.PlayPause />
          <AudioPlayer.Seek />
          <AudioPlayer.Time />
          <AudioPlayer.Speed />
        </AudioPlayer.ControlBar>
        <Collapsible.Root
          variant="plain"
          defaultOpen={transcriptStatus !== "ready"}
          style={{
            gap: "var(--space-1)",
          }}
        >
          <Collapsible.Trigger
            render={
              <Button
                type="button"
                variant="text"
                size="xs"
                className="voice-transcript-trigger"
              />
            }
            indicator={
              <Collapsible.Indicator>
                <ChevronDown size={12} />
              </Collapsible.Indicator>
            }
          >
            Transcript
          </Collapsible.Trigger>
          <Collapsible.Panel>
            {transcriptStatus === "ready" ? (
              <RecordedTranscript />
            ) : transcriptStatus === "pending" ? (
              <p className="voice-composition__draft" role="status">
                Transcribing…
              </p>
            ) : (
              <div className="voice-composition__feedback" role="alert">
                <p>Transcript unavailable.</p>
                {onRetryTranscript && (
                  <Button
                    type="button"
                    variant="ghost"
                    size="xs"
                    onClick={onRetryTranscript}
                  >
                    Retry transcript
                  </Button>
                )}
              </div>
            )}
          </Collapsible.Panel>
        </Collapsible.Root>
      </AudioPlayer.Root>
      {delivery === "queued" && (
        <p className="voice-composition__draft" role="status">
          Sending…
        </p>
      )}
      {delivery === "error" && (
        <div className="voice-composition__feedback" role="alert">
          <p>Message could not be sent.</p>
          {onRetryDelivery && (
            <Button
              type="button"
              variant="ghost"
              size="xs"
              onClick={onRetryDelivery}
            >
              Retry message
            </Button>
          )}
        </div>
      )}
    </MessageBody>
  );
}

var orbit =
  "data:image/svg+xml," +
  encodeURIComponent(
    '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><rect x="1" y="1" width="30" height="30" rx="10" fill="#8C78EA"/><path d="M16 6l3 7 7 3-7 3-3 7-3-7-7-3 7-3z" fill="white"/></svg>',
  );

var rows = [
  ["\u{1F50E}", "Magnifying glass", "frequent", "mag", "#8aaab7"],
  ["\u{1F9E0}", "Brain", "frequent", "brain", "#d879a6"],
  ["\u2728", "Sparkles", "frequent", "sparkles", "#e5b832"],
  ["\u{1F916}", "Robot", "frequent", "robot", "#6aa3bb"],
  ["\u{1F4DA}", "Books", "frequent", "books", "#4caa75"],
  ["\u{1F4A1}", "Light bulb", "frequent", "bulb", "#e9bd38"],
  ["\u{1F52C}", "Microscope", "frequent", "microscope", "#6c9cac"],
  ["\u{1F680}", "Rocket", "frequent", "rocket", "#ec6f50"],
  ["\u{1F600}", "Grinning face", "smileys", "grinning"],
  ["\u{1F60A}", "Smiling face", "smileys", "blush"],
  ["\u{1F602}", "Tears of joy", "smileys", "joy"],
  ["\u{1F979}", "Holding back tears", "smileys", "holding_back_tears"],
  ["\u{1F60D}", "Heart eyes", "smileys", "heart_eyes"],
  ["\u{1F914}", "Thinking face", "smileys", "thinking"],
  ["\u{1F60E}", "Sunglasses", "smileys", "sunglasses"],
  ["\u{1F973}", "Partying face", "smileys", "partying_face"],
  ["\u{1F917}", "Hugging face", "smileys", "hugs"],
  ["\u{1F60C}", "Relieved face", "smileys", "relieved"],
  ["\u{1F929}", "Star eyes", "smileys", "star_struck"],
  ["\u{1F605}", "Grinning with sweat", "smileys", "sweat_smile"],
  ["\u{1F44B}", "Waving hand", "smileys", "wave"],
  ["\u{1F44D}", "Thumbs up", "smileys", "+1"],
  ["\u{1F64F}", "Folded hands", "smileys", "pray"],
  ["\u{1F4AA}", "Flexed biceps", "smileys", "muscle"],
  ["\u{1F3A8}", "Artist palette", "objects", "art"],
  ["\u{1F4DD}", "Memo", "objects", "memo"],
  ["\u{1F310}", "Globe", "objects", "globe_with_meridians"],
  ["\u{1F4CA}", "Bar chart", "objects", "bar_chart"],
  ["\u{1F4AC}", "Speech balloon", "objects", "speech_balloon"],
  ["\u2B50", "Star", "objects", "star"],
  ["\u{1F3AF}", "Direct hit", "objects", "dart"],
  ["\u2764\uFE0F", "Red heart", "reactions", "heart", "#e75b52"],
  ["\u{1F389}", "Party popper", "reactions", "tada", "#e5b832"],
  ["\u{1F440}", "Eyes", "reactions", "eyes"],
];

var demoItems = rows.map((row) => ({
  id: row[3],
  label: row[1],
  content: {
    type: "emoji",
    text: row[0],
  },
  category: row[2],
  shortcodes: [row[3]],
  keywords: [
    row[1],
    row[3].replaceAll("_", " "),
    ...(row[3] === "microscope" ? ["science", "research"] : []),
  ],
  accent:
    row.length > 4 ? row[4] : row[2] === "smileys" ? "#e7b52b" : undefined,
  ...(["wave", "+1", "pray", "muscle"].includes(row[3])
    ? {
        variants: [
          "\u{1F3FB}",
          "\u{1F3FC}",
          "\u{1F3FD}",
          "\u{1F3FE}",
          "\u{1F3FF}",
        ].map((modifier, index) => ({
          id: `tone-${index + 1}`,
          tone: index + 1,
          content: {
            type: "emoji",
            text: row[0] + modifier,
          },
        })),
      }
    : {}),
}));

var workspaceItems = [
  ...demoItems.filter(
    (item) => item.category === "frequent" || item.category === "smileys",
  ),
  {
    id: "orbit",
    label: "Orbit",
    content: {
      type: "image",
      src: orbit,
    },
    category: "objects",
    categories: ["custom"],
    shortcodes: ["orbit"],
    accent: "#8c78ea",
  },
  ...demoItems.filter((item) => item.category === "objects"),
];

```

message-voice-and-transcript-16.css

```css
/* apps/web/src/demos/ui/voice-compositions.css */
.voice-composition {
  width: min(100%, 520px);
  min-width: 0;
  color: var(--foreground);
  font: var(--font-size-base)/var(--leading-copy) var(--font-sans);
}
.voice-composition .ui-message-body {
  min-width: 0;
}
.voice-composition__feedback {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--muted-foreground);
}
.voice-composition__feedback p {
  margin: 0;
}
.voice-composition__draft {
  margin: 0;
  color: var(--muted-foreground);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* apps/web/src/demos/ui/emoji-icon-picker.css */

/* apps/web/src/demos/component-thumbnails.css */

```

#### Transcript pending

message-transcript-pending-17.jsx

```jsx
import { ChevronDown } from "lucide-react";
import { AudioPlayer, useAudioPlayer } from "@/components/ui/audio-player";
import { Button } from "@/components/ui/button";
import { Collapsible } from "@/components/ui/collapsible";
import { Message, MessageBody } from "@/components/ui/message";
import { Transcript } from "@/components/ui/transcript";

export default function Example() {
  return (
    <div className="voice-composition">
      <Message actor="user" status={"complete"} aria-label="Voice note">
        <VoiceMessageContent
          transcriptStatus={"pending"}
          onRetryTranscript={undefined}
          delivery={"complete"}
          onRetryDelivery={undefined}
        />
      </Message>
    </div>
  );
}

function RecordedTranscript() {
  const player = useAudioPlayer();
  return (
    <Transcript
      segments={[
        {
          id: "response",
          text: "\u201CThe Metal Forest is in the Great Domed Cavern, the largest in all our dominions,\u201D replied Kaliko.",
          start: 0,
          end: player.duration || undefined,
          status: "final",
        },
      ]}
    />
  );
}

function VoiceMessageContent({
  transcriptStatus = "ready",
  onRetryTranscript,
  delivery = "complete",
  onRetryDelivery,
}) {
  return (
    <MessageBody>
      <AudioPlayer.Root src={"/audio/the-metal-forest.mp3"} label="Voice note">
        <AudioPlayer.ControlBar>
          <AudioPlayer.PlayPause />
          <AudioPlayer.Seek />
          <AudioPlayer.Time />
          <AudioPlayer.Speed />
        </AudioPlayer.ControlBar>
        <Collapsible.Root
          variant="plain"
          defaultOpen={transcriptStatus !== "ready"}
          style={{
            gap: "var(--space-1)",
          }}
        >
          <Collapsible.Trigger
            render={
              <Button
                type="button"
                variant="text"
                size="xs"
                className="voice-transcript-trigger"
              />
            }
            indicator={
              <Collapsible.Indicator>
                <ChevronDown size={12} />
              </Collapsible.Indicator>
            }
          >
            Transcript
          </Collapsible.Trigger>
          <Collapsible.Panel>
            {transcriptStatus === "ready" ? (
              <RecordedTranscript />
            ) : transcriptStatus === "pending" ? (
              <p className="voice-composition__draft" role="status">
                Transcribing…
              </p>
            ) : (
              <div className="voice-composition__feedback" role="alert">
                <p>Transcript unavailable.</p>
                {onRetryTranscript && (
                  <Button
                    type="button"
                    variant="ghost"
                    size="xs"
                    onClick={onRetryTranscript}
                  >
                    Retry transcript
                  </Button>
                )}
              </div>
            )}
          </Collapsible.Panel>
        </Collapsible.Root>
      </AudioPlayer.Root>
      {delivery === "queued" && (
        <p className="voice-composition__draft" role="status">
          Sending…
        </p>
      )}
      {delivery === "error" && (
        <div className="voice-composition__feedback" role="alert">
          <p>Message could not be sent.</p>
          {onRetryDelivery && (
            <Button
              type="button"
              variant="ghost"
              size="xs"
              onClick={onRetryDelivery}
            >
              Retry message
            </Button>
          )}
        </div>
      )}
    </MessageBody>
  );
}

```

message-transcript-pending-17.css

```css
/* apps/web/src/demos/ui/voice-compositions.css */
.voice-composition {
  width: min(100%, 520px);
  min-width: 0;
  color: var(--foreground);
  font: var(--font-size-base)/var(--leading-copy) var(--font-sans);
}
.voice-composition .ui-message-body {
  min-width: 0;
}
.voice-composition__feedback {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--muted-foreground);
}
.voice-composition__feedback p {
  margin: 0;
}
.voice-composition__draft {
  margin: 0;
  color: var(--muted-foreground);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

```

#### Transcript retry

message-transcript-retry-18.jsx

```jsx
import * as React from "react";
import { ChevronDown } from "lucide-react";
import { AudioPlayer, useAudioPlayer } from "@/components/ui/audio-player";
import { Button } from "@/components/ui/button";
import { Collapsible } from "@/components/ui/collapsible";
import { Message, MessageBody } from "@/components/ui/message";
import { Transcript } from "@/components/ui/transcript";

export default function Example() {
  const [status, setStatus] = React.useState("error");
  return (
    <VoiceMessageExample
      transcriptStatus={status}
      onRetryTranscript={() => setStatus("ready")}
    />
  );
}

function RecordedTranscript() {
  const player = useAudioPlayer();
  return (
    <Transcript
      segments={[
        {
          id: "response",
          text: "\u201CThe Metal Forest is in the Great Domed Cavern, the largest in all our dominions,\u201D replied Kaliko.",
          start: 0,
          end: player.duration || undefined,
          status: "final",
        },
      ]}
    />
  );
}

function VoiceMessageExample({
  transcriptStatus = "ready",
  onRetryTranscript,
  delivery = "complete",
  onRetryDelivery,
}) {
  return (
    <div className="voice-composition">
      <Message actor="user" status={"complete"} aria-label="Voice note">
        <VoiceMessageContent
          transcriptStatus={transcriptStatus}
          onRetryTranscript={onRetryTranscript}
          delivery={"complete"}
          onRetryDelivery={undefined}
        />
      </Message>
    </div>
  );
}

function VoiceMessageContent({
  transcriptStatus = "ready",
  onRetryTranscript,
  delivery = "complete",
  onRetryDelivery,
}) {
  return (
    <MessageBody>
      <AudioPlayer.Root src={"/audio/the-metal-forest.mp3"} label="Voice note">
        <AudioPlayer.ControlBar>
          <AudioPlayer.PlayPause />
          <AudioPlayer.Seek />
          <AudioPlayer.Time />
          <AudioPlayer.Speed />
        </AudioPlayer.ControlBar>
        <Collapsible.Root
          variant="plain"
          defaultOpen={transcriptStatus !== "ready"}
          style={{
            gap: "var(--space-1)",
          }}
        >
          <Collapsible.Trigger
            render={
              <Button
                type="button"
                variant="text"
                size="xs"
                className="voice-transcript-trigger"
              />
            }
            indicator={
              <Collapsible.Indicator>
                <ChevronDown size={12} />
              </Collapsible.Indicator>
            }
          >
            Transcript
          </Collapsible.Trigger>
          <Collapsible.Panel>
            {transcriptStatus === "ready" ? (
              <RecordedTranscript />
            ) : transcriptStatus === "pending" ? (
              <p className="voice-composition__draft" role="status">
                Transcribing…
              </p>
            ) : (
              <div className="voice-composition__feedback" role="alert">
                <p>Transcript unavailable.</p>
                {onRetryTranscript && (
                  <Button
                    type="button"
                    variant="ghost"
                    size="xs"
                    onClick={onRetryTranscript}
                  >
                    Retry transcript
                  </Button>
                )}
              </div>
            )}
          </Collapsible.Panel>
        </Collapsible.Root>
      </AudioPlayer.Root>
      {delivery === "queued" && (
        <p className="voice-composition__draft" role="status">
          Sending…
        </p>
      )}
      {delivery === "error" && (
        <div className="voice-composition__feedback" role="alert">
          <p>Message could not be sent.</p>
          {onRetryDelivery && (
            <Button
              type="button"
              variant="ghost"
              size="xs"
              onClick={onRetryDelivery}
            >
              Retry message
            </Button>
          )}
        </div>
      )}
    </MessageBody>
  );
}

```

message-transcript-retry-18.css

```css
/* apps/web/src/demos/ui/voice-compositions.css */
.voice-composition {
  width: min(100%, 520px);
  min-width: 0;
  color: var(--foreground);
  font: var(--font-size-base)/var(--leading-copy) var(--font-sans);
}
.voice-composition .ui-message-body {
  min-width: 0;
}
.voice-composition__feedback {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--muted-foreground);
}
.voice-composition__feedback p {
  margin: 0;
}
.voice-composition__draft {
  margin: 0;
  color: var(--muted-foreground);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

```

### Footer and Action

Footer appearance, persistence, and position are separate choices. Read metadata left to right for every bubble alignment. Human footers show the supplied timestamp, delivery icon, commands, then saved reactions. Agent footers show the supplied timestamp, commands, then citations. Alignment controls placement, not priority. Separate only nonempty groups with the canonical Separator. Use [MessageActions](/ai-elements/message-actions#commands) for commands and recovery, and [Emoji Icon Picker](/components/emoji-icon-picker#simple) for reaction selection. A citation can disclose or navigate, but it is not a command. Context menu is an alternate access path to the same command callbacks. [Conversation](/ai-elements/conversation#context-defaults) supplies roster-derived visibility defaults.

#### Footer appearance

##### Persistence

Compare persistent and interaction-revealed content at the same inline position. The two controls are explicit Message props; metadata persistence does not follow action persistence.

message-persistence-19.jsx

```jsx
import * as React2 from "react";
import { SmilePlus } from "lucide-react";
import { EmojiIconPicker } from "@/components/ui/emoji-icon-picker";
import {
  createEmojiIconCatalog,
  recordEmojiIconUsage,
  resolveEmojiIcon,
} from "@/lib/emoji-icon-picker";
import { Popover } from "@/components/ui/popover";
import { Button as Button2, IconButton } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge";
import {
  Message as Message2,
  MessageBody as MessageBody2,
  MessageContent,
  MessageFooter,
  MessageMeta,
  MessageReactions,
  MessageToolbar,
} from "@/components/ui/message";
import {
  MessageActions,
  MessageDelivery,
  MessageEdit,
} from "@/components/ui/message-actions";
import { Toolbar } from "@/components/ui/toolbar";
import { CitationProvider } from "@/components/ui/citation";

export default function Example2() {
  return (
    <CitationProvider sources={footerSources} mode="provided">
      <div
        data-preview-wide
        style={{
          display: "grid",
          gap: "var(--space-4)",
        }}
      >
        <MessageFooterRecipeDemo
          position="inline"
          actionsReveal={false}
          metadataAtRest
        />
        <MessageFooterRecipeDemo
          position="inline"
          actionsReveal
          metadataAtRest
        />
      </div>
    </CitationProvider>
  );
}

var orbit =
  "data:image/svg+xml," +
  encodeURIComponent(
    '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><rect x="1" y="1" width="30" height="30" rx="10" fill="#8C78EA"/><path d="M16 6l3 7 7 3-7 3-3 7-3-7-7-3 7-3z" fill="white"/></svg>',
  );

var rows = [
  ["\u{1F50E}", "Magnifying glass", "frequent", "mag", "#8aaab7"],
  ["\u{1F9E0}", "Brain", "frequent", "brain", "#d879a6"],
  ["\u2728", "Sparkles", "frequent", "sparkles", "#e5b832"],
  ["\u{1F916}", "Robot", "frequent", "robot", "#6aa3bb"],
  ["\u{1F4DA}", "Books", "frequent", "books", "#4caa75"],
  ["\u{1F4A1}", "Light bulb", "frequent", "bulb", "#e9bd38"],
  ["\u{1F52C}", "Microscope", "frequent", "microscope", "#6c9cac"],
  ["\u{1F680}", "Rocket", "frequent", "rocket", "#ec6f50"],
  ["\u{1F600}", "Grinning face", "smileys", "grinning"],
  ["\u{1F60A}", "Smiling face", "smileys", "blush"],
  ["\u{1F602}", "Tears of joy", "smileys", "joy"],
  ["\u{1F979}", "Holding back tears", "smileys", "holding_back_tears"],
  ["\u{1F60D}", "Heart eyes", "smileys", "heart_eyes"],
  ["\u{1F914}", "Thinking face", "smileys", "thinking"],
  ["\u{1F60E}", "Sunglasses", "smileys", "sunglasses"],
  ["\u{1F973}", "Partying face", "smileys", "partying_face"],
  ["\u{1F917}", "Hugging face", "smileys", "hugs"],
  ["\u{1F60C}", "Relieved face", "smileys", "relieved"],
  ["\u{1F929}", "Star eyes", "smileys", "star_struck"],
  ["\u{1F605}", "Grinning with sweat", "smileys", "sweat_smile"],
  ["\u{1F44B}", "Waving hand", "smileys", "wave"],
  ["\u{1F44D}", "Thumbs up", "smileys", "+1"],
  ["\u{1F64F}", "Folded hands", "smileys", "pray"],
  ["\u{1F4AA}", "Flexed biceps", "smileys", "muscle"],
  ["\u{1F3A8}", "Artist palette", "objects", "art"],
  ["\u{1F4DD}", "Memo", "objects", "memo"],
  ["\u{1F310}", "Globe", "objects", "globe_with_meridians"],
  ["\u{1F4CA}", "Bar chart", "objects", "bar_chart"],
  ["\u{1F4AC}", "Speech balloon", "objects", "speech_balloon"],
  ["\u2B50", "Star", "objects", "star"],
  ["\u{1F3AF}", "Direct hit", "objects", "dart"],
  ["\u2764\uFE0F", "Red heart", "reactions", "heart", "#e75b52"],
  ["\u{1F389}", "Party popper", "reactions", "tada", "#e5b832"],
  ["\u{1F440}", "Eyes", "reactions", "eyes"],
];

var demoItems = rows.map((row) => ({
  id: row[3],
  label: row[1],
  content: {
    type: "emoji",
    text: row[0],
  },
  category: row[2],
  shortcodes: [row[3]],
  keywords: [
    row[1],
    row[3].replaceAll("_", " "),
    ...(row[3] === "microscope" ? ["science", "research"] : []),
  ],
  accent:
    row.length > 4 ? row[4] : row[2] === "smileys" ? "#e7b52b" : undefined,
  ...(["wave", "+1", "pray", "muscle"].includes(row[3])
    ? {
        variants: [
          "\u{1F3FB}",
          "\u{1F3FC}",
          "\u{1F3FD}",
          "\u{1F3FE}",
          "\u{1F3FF}",
        ].map((modifier, index) => ({
          id: `tone-${index + 1}`,
          tone: index + 1,
          content: {
            type: "emoji",
            text: row[0] + modifier,
          },
        })),
      }
    : {}),
}));

var workspaceItems = [
  ...demoItems.filter(
    (item) => item.category === "frequent" || item.category === "smileys",
  ),
  {
    id: "orbit",
    label: "Orbit",
    content: {
      type: "image",
      src: orbit,
    },
    category: "objects",
    categories: ["custom"],
    shortcodes: ["orbit"],
    accent: "#8c78ea",
  },
  ...demoItems.filter((item) => item.category === "objects"),
];

var demoCategories = [
  {
    id: "frequent",
    label: "Frequently used",
  },
  {
    id: "smileys",
    label: "Smileys & people",
  },
  {
    id: "objects",
    label: "Workspace",
  },
  {
    id: "custom",
    label: "Custom",
  },
  {
    id: "reactions",
    label: "Reactions",
  },
];

function exactSelection(value, item) {
  return value && item?.variantId
    ? {
        id: value.id,
        variantId: item.variantId,
      }
    : value;
}

function Example({ name, children, className }) {
  return (
    <div
      className={["web-emoji-icon-picker-example", undefined]
        .filter(Boolean)
        .join(" ")}
      data-emoji-icon-case={name}
    >
      {children}
    </div>
  );
}

function CompleteParts({ onRetry, searchPlacement = "top" } = {}) {
  const search = (
    <EmojiIconPicker.Search>
      <EmojiIconPicker.SkinTone />
    </EmojiIconPicker.Search>
  );
  const tabs = (
    <EmojiIconPicker.Tabs
      categoryIds={["smileys", "objects", "custom"]}
      renderLabel={(group) =>
        ({
          smileys: "Smileys",
          objects: "Objects",
          custom: "Custom",
        })[group.id] ?? group.label
      }
    />
  );
  const grid = (
    <EmojiIconPicker.CategoryPanel>
      <EmojiIconPicker.Grid labels onRetry={onRetry} />
    </EmojiIconPicker.CategoryPanel>
  );
  return searchPlacement === "bottom" ? (
    <>
      <EmojiIconPicker.Preview />
      {grid}
      {tabs}
      {search}
    </>
  ) : (
    <>
      {search}
      {tabs}
      {grid}
      <EmojiIconPicker.Preview />
    </>
  );
}

function Choice({ item, renderIcon }) {
  const content = item.content;
  return content.type === "emoji" ? (
    <>{content.text}</>
  ) : content.type === "image" ? (
    <img src={content.src} alt="" width="22" height="22" />
  ) : (
    <>{renderIcon?.(content, item)}</>
  );
}

var reactionHistory = /* @__PURE__ */ [
  "robot",
  "brain",
  "microscope",
  "sparkles",
  "rocket",
  "books",
  "globe_with_meridians",
  "memo",
  "heart",
  "+1",
].map((id, index) => ({
  id,
  count: 10 - index,
  lastUsedAt: 100 - index,
}));

function ReactionExample({
  presentation,
  count = 6,
  size = "base",
  metadata = false,
  deliveryInBubble = false,
  footerPosition,
  actionsReveal = true,
  metadataAtRest = true,
}) {
  const [quickOpen, setQuickOpen] = React2.useState(false);
  const fullRequested = React2.useRef(false);
  const [open, setOpen] = React2.useState(false);
  const [keyboardOpen, setKeyboardOpen] = React2.useState(false);
  const message = React2.useRef(null);
  const origin = React2.useRef(null);
  const summary = React2.useRef(null);
  const [usage, setUsage] = React2.useState(reactionHistory);
  const [reactions, setReactions] = React2.useState([
    {
      selection: {
        id: "+1",
      },
      count: 3,
    },
    {
      selection: {
        id: "sparkles",
      },
      count: 2,
    },
  ]);
  const [messageText, setMessageText] = React2.useState(
    deliveryInBubble
      ? "The review covered the delivery estimate, regional handoff, and the final two checks. I\u2019ve updated the timing after confirming the carrier window."
      : footerPosition
        ? "Can we move the rollout review to Friday?"
        : "I found 6 sources for the launch plan.",
  );
  const [editing, setEditing] = React2.useState(false);
  const items = React2.useMemo(
    () => [...demoItems, workspaceItems.find((item) => item.id === "orbit")],
    [],
  );
  const catalog = React2.useMemo(() => createEmojiIconCatalog(items), [items]);
  const pick = (value, item) => {
    const selection = exactSelection(value, item);
    if (!selection) return;
    setUsage((current) => recordEmojiIconUsage(current, selection.id));
    setReactions((current) => {
      const matches = (reaction) =>
        reaction.selection.id === selection.id &&
        reaction.selection.variantId === selection.variantId;
      const existing = current.find(matches);
      if (!existing)
        return [
          ...current,
          {
            selection,
            count: 1,
          },
        ];
      return current.map((reaction) =>
        matches(reaction)
          ? {
              ...reaction,
              count: reaction.count + 1,
            }
          : reaction,
      );
    });
    setQuickOpen(false);
  };
  const reactionTotal = reactions.reduce(
    (sum, reaction) => sum + reaction.count,
    0,
  );
  const reactionLabels = reactions
    .map(
      (reaction) =>
        (resolveEmojiIcon(catalog, reaction.selection)?.label ?? "Reaction") +
        ": " +
        reaction.count,
    )
    .join(", ");
  const exampleName = footerPosition
    ? `footer-${footerPosition}-${actionsReveal ? "interaction" : "persistent"}`
    : "floating-metadata";
  if (editing)
    return (
      <Example name={exampleName}>
        <MessageEdit
          defaultValue={messageText}
          originalText={messageText}
          originalAuthor="Rina"
          submitLabel="Save changes"
          onCancel={() => setEditing(false)}
          onSubmit={async (text) => {
            setMessageText(text);
            setEditing(false);
          }}
        />
      </Example>
    );
  const footer = (
    <MessageToolbar>
      {!deliveryInBubble && (
        <>
          <Toolbar.Group aria-label="Message metadata">
            <MessageMeta>
              <time dateTime="2026-11-09T10:24:00+07:00">10:24</time>
              <MessageDelivery
                delivery={{
                  status: "read",
                  recipients: [
                    {
                      id: "marta",
                      name: "Marta Chen",
                      sentAt: "2026-11-09T10:20:00+07:00",
                      deliveredAt: "2026-11-09T10:20:02+07:00",
                      readAt: "2026-11-09T10:23:00+07:00",
                    },
                  ],
                }}
              />
            </MessageMeta>
          </Toolbar.Group>
          <Toolbar.Separator />
        </>
      )}
      <Toolbar.Group aria-label="Message actions">
        <MessageActions text={messageText} onEdit={() => setEditing(true)} />
        <Popover.Trigger
          render={
            <Toolbar.Button
              render={
                <IconButton
                  variant="ghost"
                  size="icon-sm"
                  aria-label="Add reaction"
                  icon={<SmilePlus />}
                />
              }
            />
          }
        />
      </Toolbar.Group>
      {reactions.length > 0 && <Toolbar.Separator />}
      {reactions.length > 0 && (
        <>
          <Toolbar.Group aria-label="Saved reactions">
            <MessageReactions
              aria-label="Message reactions"
              data-reaction-total={reactionTotal}
            >
              <Popover.Trigger
                ref={summary}
                render={
                  <Toolbar.Button
                    render={
                      <Button2
                        type="button"
                        variant="ghost"
                        size="sm"
                        className="web-emoji-icon-picker-applied"
                        aria-label={`Choose a reaction. ${reactionLabels}; ${reactionTotal} total reactions`}
                        title="Choose a reaction"
                      />
                    }
                  />
                }
              >
                <span
                  className="web-emoji-icon-picker-applied-stack"
                  aria-hidden="true"
                >
                  {reactions.map((reaction) => {
                    const item = resolveEmojiIcon(catalog, reaction.selection);
                    return (
                      <span
                        key={
                          reaction.selection.id +
                          ":" +
                          (reaction.selection.variantId ?? "")
                        }
                      >
                        {item ? <Choice item={item} /> : null}
                      </span>
                    );
                  })}
                </span>
                <Badge
                  kind="counter"
                  size="sm"
                  className="web-emoji-icon-picker-applied-count"
                  aria-hidden="true"
                >
                  {reactionTotal}
                </Badge>
              </Popover.Trigger>
            </MessageReactions>
          </Toolbar.Group>
        </>
      )}
    </MessageToolbar>
  );
  return (
    <Example name={exampleName}>
      <Message2
        ref={message}
        actor="user"
        actionsReveal={actionsReveal}
        metadataAtRest={metadataAtRest}
        className="web-emoji-icon-picker-reaction-message"
      >
        <Popover.Root
          open={quickOpen}
          onOpenChange={(next, details) => {
            if (next && details.trigger instanceof HTMLButtonElement)
              origin.current = details.trigger;
            setQuickOpen(next);
          }}
          onOpenChangeComplete={(next) => {
            if (!next && fullRequested.current) {
              fullRequested.current = false;
              setOpen(true);
            }
          }}
        >
          <MessageContent>
            <MessageBody2 appearance="subtle">
              {messageText}
              {deliveryInBubble && true && (
                <MessageMeta placement="inline">
                  <time dateTime="2026-11-09T09:45:00+07:00">9:45 AM</time>
                  <MessageDelivery
                    delivery={{
                      status: "read",
                      recipients: [
                        {
                          id: "marta",
                          name: "Marta Chen",
                          sentAt: "2026-11-09T09:42:00+07:00",
                          deliveredAt: "2026-11-09T09:42:02+07:00",
                          readAt: "2026-11-09T09:44:00+07:00",
                        },
                      ],
                    }}
                  />
                </MessageMeta>
              )}
            </MessageBody2>
            {footerPosition === "inline" && (
              <MessageFooter>{footer}</MessageFooter>
            )}
          </MessageContent>
          {footerPosition === "floating"
            ? footer
            : !footerPosition
              ? footer
              : null}
          <Popover.Portal>
            <Popover.Positioner
              side="bottom"
              align={"end"}
              sideOffset={8}
              collisionAvoidance={{
                side: "none",
                align: "shift",
              }}
            >
              <Popover.Popup
                className="web-emoji-icon-picker-quick-popup"
                finalFocus={() =>
                  fullRequested.current || open ? false : origin.current
                }
              >
                <Popover.Arrow />
                <div
                  className={"web-emoji-icon-picker-reaction-narrow"}
                  onKeyDownCapture={() => setKeyboardOpen(true)}
                  onPointerDownCapture={() => setKeyboardOpen(false)}
                >
                  <EmojiIconPicker.Simple
                    surface="inline"
                    items={items}
                    categories={demoCategories}
                    size={"base"}
                    usage={usage}
                    count={6}
                    order="recent"
                    onValueChange={pick}
                    onMore={() => {
                      fullRequested.current = true;
                      setQuickOpen(false);
                    }}
                  />
                </div>
              </Popover.Popup>
            </Popover.Positioner>
          </Popover.Portal>
        </Popover.Root>
      </Message2>
      <EmojiIconPicker.Root
        open={open}
        onOpenChange={setOpen}
        items={items}
        categories={demoCategories}
        size={"base"}
        columns={6}
        onValueChange={pick}
      >
        <EmojiIconPicker.Popup
          aria-label="Choose a reaction"
          align="end"
          positionerProps={{
            anchor: () => summary.current ?? origin.current,
          }}
          finalFocus={() => summary.current ?? origin.current}
        >
          <CompleteParts />
        </EmojiIconPicker.Popup>
      </EmojiIconPicker.Root>
      {false}
    </Example>
  );
}

function MessageFooterRecipeDemo({
  position,
  actionsReveal,
  metadataAtRest = true,
  deliveryInBubble = false,
}) {
  return (
    <ReactionExample
      presentation="popup"
      count={6}
      metadata
      deliveryInBubble={deliveryInBubble}
      footerPosition={position}
      actionsReveal={actionsReveal}
      metadataAtRest={metadataAtRest}
    />
  );
}

var footerSources = [
  {
    id: "release-runbook",
    type: "url",
    title: "Release runbook",
    url: "https://example.com/runbook",
  },
];

```

message-persistence-19.css

```css
/* apps/web/src/demos/ui/voice-compositions.css */

/* apps/web/src/demos/ui/emoji-icon-picker.css */
.web-emoji-icon-picker-example {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  min-width: 0;
  padding: 24px 12px;
}
.web-emoji-icon-picker-reaction-message {
  width: 344px;
  max-width: 100%;
}
.web-emoji-icon-picker-reaction-message .ui-message-footer {
  width: 100%;
}
.web-emoji-icon-picker-reaction-narrow {
  width: 216px;
  max-width: 100%;
}
.web-emoji-icon-picker-example[data-emoji-icon-case=preview] {
  min-height: 240px;
}
.ui-popover.web-emoji-icon-picker-quick-popup {
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 0;
  gap: 0;
  overflow: visible;
  transition: none;
}
.ui-button.web-emoji-icon-picker-applied {
  gap: var(--space-1);
  padding: 0 4px;
  border-radius: var(--radius-control-base);
}
.web-emoji-icon-picker-applied-stack {
  display: inline-flex;
  align-items: center;
}
.web-emoji-icon-picker-applied-stack > span {
  display: inline-flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 14px;
}
.web-emoji-icon-picker-applied-stack > span + span {
  margin-inline-start: -4px;
}
.web-emoji-icon-picker-applied-stack :is(img, svg) {
  width: 12px;
  height: 12px;
  object-fit: contain;
}
.ui-badge.web-emoji-icon-picker-applied-count {
  min-width: 0;
  height: 14px;
  padding-inline: 2px;
  font-size: 10px;
  line-height: 12px;
  font-weight: 400;
}
.web-emoji-icon-picker-example > .ui-emoji-icon-picker__trigger {
  align-self: center;
}
.web-emoji-icon-picker-quick-popup .ui-emoji-icon-picker__surface {
  width: 100%;
}
.web-emoji-icon-picker-quick-popup .ui-emoji-icon-picker__grid {
  padding-inline: 8px;
}
.web-emoji-icon-picker-quick-popup > div {
  border-radius: inherit;
  overflow: hidden;
}

/* apps/web/src/demos/component-thumbnails.css */

```

##### Position

Compare floating and separate inline placement with the same persistent commands and metadata. Floating is a 32px toolbar with a 12px radius, half-overlaid on the message; inline participates in content flow.

message-position-20.jsx

```jsx
import * as React2 from "react";
import { SmilePlus } from "lucide-react";
import { EmojiIconPicker } from "@/components/ui/emoji-icon-picker";
import {
  createEmojiIconCatalog,
  recordEmojiIconUsage,
  resolveEmojiIcon,
} from "@/lib/emoji-icon-picker";
import { Popover } from "@/components/ui/popover";
import { Button as Button2, IconButton } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge";
import {
  Message as Message2,
  MessageBody as MessageBody2,
  MessageContent,
  MessageFooter,
  MessageMeta,
  MessageReactions,
  MessageToolbar,
} from "@/components/ui/message";
import {
  MessageActions,
  MessageDelivery,
  MessageEdit,
} from "@/components/ui/message-actions";
import { Toolbar } from "@/components/ui/toolbar";
import { CitationProvider } from "@/components/ui/citation";

export default function Example2() {
  return (
    <CitationProvider sources={footerSources} mode="provided">
      <div
        data-preview-wide
        style={{
          display: "grid",
          gap: "var(--space-4)",
        }}
      >
        <MessageFooterRecipeDemo
          position="inline"
          actionsReveal={false}
          metadataAtRest
        />
        <MessageFooterRecipeDemo
          position="floating"
          actionsReveal={false}
          metadataAtRest
        />
      </div>
    </CitationProvider>
  );
}

var orbit =
  "data:image/svg+xml," +
  encodeURIComponent(
    '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><rect x="1" y="1" width="30" height="30" rx="10" fill="#8C78EA"/><path d="M16 6l3 7 7 3-7 3-3 7-3-7-7-3 7-3z" fill="white"/></svg>',
  );

var rows = [
  ["\u{1F50E}", "Magnifying glass", "frequent", "mag", "#8aaab7"],
  ["\u{1F9E0}", "Brain", "frequent", "brain", "#d879a6"],
  ["\u2728", "Sparkles", "frequent", "sparkles", "#e5b832"],
  ["\u{1F916}", "Robot", "frequent", "robot", "#6aa3bb"],
  ["\u{1F4DA}", "Books", "frequent", "books", "#4caa75"],
  ["\u{1F4A1}", "Light bulb", "frequent", "bulb", "#e9bd38"],
  ["\u{1F52C}", "Microscope", "frequent", "microscope", "#6c9cac"],
  ["\u{1F680}", "Rocket", "frequent", "rocket", "#ec6f50"],
  ["\u{1F600}", "Grinning face", "smileys", "grinning"],
  ["\u{1F60A}", "Smiling face", "smileys", "blush"],
  ["\u{1F602}", "Tears of joy", "smileys", "joy"],
  ["\u{1F979}", "Holding back tears", "smileys", "holding_back_tears"],
  ["\u{1F60D}", "Heart eyes", "smileys", "heart_eyes"],
  ["\u{1F914}", "Thinking face", "smileys", "thinking"],
  ["\u{1F60E}", "Sunglasses", "smileys", "sunglasses"],
  ["\u{1F973}", "Partying face", "smileys", "partying_face"],
  ["\u{1F917}", "Hugging face", "smileys", "hugs"],
  ["\u{1F60C}", "Relieved face", "smileys", "relieved"],
  ["\u{1F929}", "Star eyes", "smileys", "star_struck"],
  ["\u{1F605}", "Grinning with sweat", "smileys", "sweat_smile"],
  ["\u{1F44B}", "Waving hand", "smileys", "wave"],
  ["\u{1F44D}", "Thumbs up", "smileys", "+1"],
  ["\u{1F64F}", "Folded hands", "smileys", "pray"],
  ["\u{1F4AA}", "Flexed biceps", "smileys", "muscle"],
  ["\u{1F3A8}", "Artist palette", "objects", "art"],
  ["\u{1F4DD}", "Memo", "objects", "memo"],
  ["\u{1F310}", "Globe", "objects", "globe_with_meridians"],
  ["\u{1F4CA}", "Bar chart", "objects", "bar_chart"],
  ["\u{1F4AC}", "Speech balloon", "objects", "speech_balloon"],
  ["\u2B50", "Star", "objects", "star"],
  ["\u{1F3AF}", "Direct hit", "objects", "dart"],
  ["\u2764\uFE0F", "Red heart", "reactions", "heart", "#e75b52"],
  ["\u{1F389}", "Party popper", "reactions", "tada", "#e5b832"],
  ["\u{1F440}", "Eyes", "reactions", "eyes"],
];

var demoItems = rows.map((row) => ({
  id: row[3],
  label: row[1],
  content: {
    type: "emoji",
    text: row[0],
  },
  category: row[2],
  shortcodes: [row[3]],
  keywords: [
    row[1],
    row[3].replaceAll("_", " "),
    ...(row[3] === "microscope" ? ["science", "research"] : []),
  ],
  accent:
    row.length > 4 ? row[4] : row[2] === "smileys" ? "#e7b52b" : undefined,
  ...(["wave", "+1", "pray", "muscle"].includes(row[3])
    ? {
        variants: [
          "\u{1F3FB}",
          "\u{1F3FC}",
          "\u{1F3FD}",
          "\u{1F3FE}",
          "\u{1F3FF}",
        ].map((modifier, index) => ({
          id: `tone-${index + 1}`,
          tone: index + 1,
          content: {
            type: "emoji",
            text: row[0] + modifier,
          },
        })),
      }
    : {}),
}));

var workspaceItems = [
  ...demoItems.filter(
    (item) => item.category === "frequent" || item.category === "smileys",
  ),
  {
    id: "orbit",
    label: "Orbit",
    content: {
      type: "image",
      src: orbit,
    },
    category: "objects",
    categories: ["custom"],
    shortcodes: ["orbit"],
    accent: "#8c78ea",
  },
  ...demoItems.filter((item) => item.category === "objects"),
];

var demoCategories = [
  {
    id: "frequent",
    label: "Frequently used",
  },
  {
    id: "smileys",
    label: "Smileys & people",
  },
  {
    id: "objects",
    label: "Workspace",
  },
  {
    id: "custom",
    label: "Custom",
  },
  {
    id: "reactions",
    label: "Reactions",
  },
];

function exactSelection(value, item) {
  return value && item?.variantId
    ? {
        id: value.id,
        variantId: item.variantId,
      }
    : value;
}

function Example({ name, children, className }) {
  return (
    <div
      className={["web-emoji-icon-picker-example", undefined]
        .filter(Boolean)
        .join(" ")}
      data-emoji-icon-case={name}
    >
      {children}
    </div>
  );
}

function CompleteParts({ onRetry, searchPlacement = "top" } = {}) {
  const search = (
    <EmojiIconPicker.Search>
      <EmojiIconPicker.SkinTone />
    </EmojiIconPicker.Search>
  );
  const tabs = (
    <EmojiIconPicker.Tabs
      categoryIds={["smileys", "objects", "custom"]}
      renderLabel={(group) =>
        ({
          smileys: "Smileys",
          objects: "Objects",
          custom: "Custom",
        })[group.id] ?? group.label
      }
    />
  );
  const grid = (
    <EmojiIconPicker.CategoryPanel>
      <EmojiIconPicker.Grid labels onRetry={onRetry} />
    </EmojiIconPicker.CategoryPanel>
  );
  return searchPlacement === "bottom" ? (
    <>
      <EmojiIconPicker.Preview />
      {grid}
      {tabs}
      {search}
    </>
  ) : (
    <>
      {search}
      {tabs}
      {grid}
      <EmojiIconPicker.Preview />
    </>
  );
}

function Choice({ item, renderIcon }) {
  const content = item.content;
  return content.type === "emoji" ? (
    <>{content.text}</>
  ) : content.type === "image" ? (
    <img src={content.src} alt="" width="22" height="22" />
  ) : (
    <>{renderIcon?.(content, item)}</>
  );
}

var reactionHistory = /* @__PURE__ */ [
  "robot",
  "brain",
  "microscope",
  "sparkles",
  "rocket",
  "books",
  "globe_with_meridians",
  "memo",
  "heart",
  "+1",
].map((id, index) => ({
  id,
  count: 10 - index,
  lastUsedAt: 100 - index,
}));

function ReactionExample({
  presentation,
  count = 6,
  size = "base",
  metadata = false,
  deliveryInBubble = false,
  footerPosition,
  actionsReveal = true,
  metadataAtRest = true,
}) {
  const [quickOpen, setQuickOpen] = React2.useState(false);
  const fullRequested = React2.useRef(false);
  const [open, setOpen] = React2.useState(false);
  const [keyboardOpen, setKeyboardOpen] = React2.useState(false);
  const message = React2.useRef(null);
  const origin = React2.useRef(null);
  const summary = React2.useRef(null);
  const [usage, setUsage] = React2.useState(reactionHistory);
  const [reactions, setReactions] = React2.useState([
    {
      selection: {
        id: "+1",
      },
      count: 3,
    },
    {
      selection: {
        id: "sparkles",
      },
      count: 2,
    },
  ]);
  const [messageText, setMessageText] = React2.useState(
    deliveryInBubble
      ? "The review covered the delivery estimate, regional handoff, and the final two checks. I\u2019ve updated the timing after confirming the carrier window."
      : footerPosition
        ? "Can we move the rollout review to Friday?"
        : "I found 6 sources for the launch plan.",
  );
  const [editing, setEditing] = React2.useState(false);
  const items = React2.useMemo(
    () => [...demoItems, workspaceItems.find((item) => item.id === "orbit")],
    [],
  );
  const catalog = React2.useMemo(() => createEmojiIconCatalog(items), [items]);
  const pick = (value, item) => {
    const selection = exactSelection(value, item);
    if (!selection) return;
    setUsage((current) => recordEmojiIconUsage(current, selection.id));
    setReactions((current) => {
      const matches = (reaction) =>
        reaction.selection.id === selection.id &&
        reaction.selection.variantId === selection.variantId;
      const existing = current.find(matches);
      if (!existing)
        return [
          ...current,
          {
            selection,
            count: 1,
          },
        ];
      return current.map((reaction) =>
        matches(reaction)
          ? {
              ...reaction,
              count: reaction.count + 1,
            }
          : reaction,
      );
    });
    setQuickOpen(false);
  };
  const reactionTotal = reactions.reduce(
    (sum, reaction) => sum + reaction.count,
    0,
  );
  const reactionLabels = reactions
    .map(
      (reaction) =>
        (resolveEmojiIcon(catalog, reaction.selection)?.label ?? "Reaction") +
        ": " +
        reaction.count,
    )
    .join(", ");
  const exampleName = footerPosition
    ? `footer-${footerPosition}-${actionsReveal ? "interaction" : "persistent"}`
    : "floating-metadata";
  if (editing)
    return (
      <Example name={exampleName}>
        <MessageEdit
          defaultValue={messageText}
          originalText={messageText}
          originalAuthor="Rina"
          submitLabel="Save changes"
          onCancel={() => setEditing(false)}
          onSubmit={async (text) => {
            setMessageText(text);
            setEditing(false);
          }}
        />
      </Example>
    );
  const footer = (
    <MessageToolbar>
      {!deliveryInBubble && (
        <>
          <Toolbar.Group aria-label="Message metadata">
            <MessageMeta>
              <time dateTime="2026-11-09T10:24:00+07:00">10:24</time>
              <MessageDelivery
                delivery={{
                  status: "read",
                  recipients: [
                    {
                      id: "marta",
                      name: "Marta Chen",
                      sentAt: "2026-11-09T10:20:00+07:00",
                      deliveredAt: "2026-11-09T10:20:02+07:00",
                      readAt: "2026-11-09T10:23:00+07:00",
                    },
                  ],
                }}
              />
            </MessageMeta>
          </Toolbar.Group>
          <Toolbar.Separator />
        </>
      )}
      <Toolbar.Group aria-label="Message actions">
        <MessageActions text={messageText} onEdit={() => setEditing(true)} />
        <Popover.Trigger
          render={
            <Toolbar.Button
              render={
                <IconButton
                  variant="ghost"
                  size="icon-sm"
                  aria-label="Add reaction"
                  icon={<SmilePlus />}
                />
              }
            />
          }
        />
      </Toolbar.Group>
      {reactions.length > 0 && <Toolbar.Separator />}
      {reactions.length > 0 && (
        <>
          <Toolbar.Group aria-label="Saved reactions">
            <MessageReactions
              aria-label="Message reactions"
              data-reaction-total={reactionTotal}
            >
              <Popover.Trigger
                ref={summary}
                render={
                  <Toolbar.Button
                    render={
                      <Button2
                        type="button"
                        variant="ghost"
                        size="sm"
                        className="web-emoji-icon-picker-applied"
                        aria-label={`Choose a reaction. ${reactionLabels}; ${reactionTotal} total reactions`}
                        title="Choose a reaction"
                      />
                    }
                  />
                }
              >
                <span
                  className="web-emoji-icon-picker-applied-stack"
                  aria-hidden="true"
                >
                  {reactions.map((reaction) => {
                    const item = resolveEmojiIcon(catalog, reaction.selection);
                    return (
                      <span
                        key={
                          reaction.selection.id +
                          ":" +
                          (reaction.selection.variantId ?? "")
                        }
                      >
                        {item ? <Choice item={item} /> : null}
                      </span>
                    );
                  })}
                </span>
                <Badge
                  kind="counter"
                  size="sm"
                  className="web-emoji-icon-picker-applied-count"
                  aria-hidden="true"
                >
                  {reactionTotal}
                </Badge>
              </Popover.Trigger>
            </MessageReactions>
          </Toolbar.Group>
        </>
      )}
    </MessageToolbar>
  );
  return (
    <Example name={exampleName}>
      <Message2
        ref={message}
        actor="user"
        actionsReveal={actionsReveal}
        metadataAtRest={metadataAtRest}
        className="web-emoji-icon-picker-reaction-message"
      >
        <Popover.Root
          open={quickOpen}
          onOpenChange={(next, details) => {
            if (next && details.trigger instanceof HTMLButtonElement)
              origin.current = details.trigger;
            setQuickOpen(next);
          }}
          onOpenChangeComplete={(next) => {
            if (!next && fullRequested.current) {
              fullRequested.current = false;
              setOpen(true);
            }
          }}
        >
          <MessageContent>
            <MessageBody2 appearance="subtle">
              {messageText}
              {deliveryInBubble && true && (
                <MessageMeta placement="inline">
                  <time dateTime="2026-11-09T09:45:00+07:00">9:45 AM</time>
                  <MessageDelivery
                    delivery={{
                      status: "read",
                      recipients: [
                        {
                          id: "marta",
                          name: "Marta Chen",
                          sentAt: "2026-11-09T09:42:00+07:00",
                          deliveredAt: "2026-11-09T09:42:02+07:00",
                          readAt: "2026-11-09T09:44:00+07:00",
                        },
                      ],
                    }}
                  />
                </MessageMeta>
              )}
            </MessageBody2>
            {footerPosition === "inline" && (
              <MessageFooter>{footer}</MessageFooter>
            )}
          </MessageContent>
          {footerPosition === "floating"
            ? footer
            : !footerPosition
              ? footer
              : null}
          <Popover.Portal>
            <Popover.Positioner
              side="bottom"
              align={"end"}
              sideOffset={8}
              collisionAvoidance={{
                side: "none",
                align: "shift",
              }}
            >
              <Popover.Popup
                className="web-emoji-icon-picker-quick-popup"
                finalFocus={() =>
                  fullRequested.current || open ? false : origin.current
                }
              >
                <Popover.Arrow />
                <div
                  className={"web-emoji-icon-picker-reaction-narrow"}
                  onKeyDownCapture={() => setKeyboardOpen(true)}
                  onPointerDownCapture={() => setKeyboardOpen(false)}
                >
                  <EmojiIconPicker.Simple
                    surface="inline"
                    items={items}
                    categories={demoCategories}
                    size={"base"}
                    usage={usage}
                    count={6}
                    order="recent"
                    onValueChange={pick}
                    onMore={() => {
                      fullRequested.current = true;
                      setQuickOpen(false);
                    }}
                  />
                </div>
              </Popover.Popup>
            </Popover.Positioner>
          </Popover.Portal>
        </Popover.Root>
      </Message2>
      <EmojiIconPicker.Root
        open={open}
        onOpenChange={setOpen}
        items={items}
        categories={demoCategories}
        size={"base"}
        columns={6}
        onValueChange={pick}
      >
        <EmojiIconPicker.Popup
          aria-label="Choose a reaction"
          align="end"
          positionerProps={{
            anchor: () => summary.current ?? origin.current,
          }}
          finalFocus={() => summary.current ?? origin.current}
        >
          <CompleteParts />
        </EmojiIconPicker.Popup>
      </EmojiIconPicker.Root>
      {false}
    </Example>
  );
}

function MessageFooterRecipeDemo({
  position,
  actionsReveal,
  metadataAtRest = true,
  deliveryInBubble = false,
}) {
  return (
    <ReactionExample
      presentation="popup"
      count={6}
      metadata
      deliveryInBubble={deliveryInBubble}
      footerPosition={position}
      actionsReveal={actionsReveal}
      metadataAtRest={metadataAtRest}
    />
  );
}

var footerSources = [
  {
    id: "release-runbook",
    type: "url",
    title: "Release runbook",
    url: "https://example.com/runbook",
  },
];

```

message-position-20.css

```css
/* apps/web/src/demos/ui/voice-compositions.css */

/* apps/web/src/demos/ui/emoji-icon-picker.css */
.web-emoji-icon-picker-example {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  min-width: 0;
  padding: 24px 12px;
}
.web-emoji-icon-picker-reaction-message {
  width: 344px;
  max-width: 100%;
}
.web-emoji-icon-picker-reaction-message .ui-message-footer {
  width: 100%;
}
.web-emoji-icon-picker-reaction-narrow {
  width: 216px;
  max-width: 100%;
}
.web-emoji-icon-picker-example[data-emoji-icon-case=preview] {
  min-height: 240px;
}
.ui-popover.web-emoji-icon-picker-quick-popup {
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 0;
  gap: 0;
  overflow: visible;
  transition: none;
}
.ui-button.web-emoji-icon-picker-applied {
  gap: var(--space-1);
  padding: 0 4px;
  border-radius: var(--radius-control-base);
}
.web-emoji-icon-picker-applied-stack {
  display: inline-flex;
  align-items: center;
}
.web-emoji-icon-picker-applied-stack > span {
  display: inline-flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 14px;
}
.web-emoji-icon-picker-applied-stack > span + span {
  margin-inline-start: -4px;
}
.web-emoji-icon-picker-applied-stack :is(img, svg) {
  width: 12px;
  height: 12px;
  object-fit: contain;
}
.ui-badge.web-emoji-icon-picker-applied-count {
  min-width: 0;
  height: 14px;
  padding-inline: 2px;
  font-size: 10px;
  line-height: 12px;
  font-weight: 400;
}
.web-emoji-icon-picker-example > .ui-emoji-icon-picker__trigger {
  align-self: center;
}
.web-emoji-icon-picker-quick-popup .ui-emoji-icon-picker__surface {
  width: 100%;
}
.web-emoji-icon-picker-quick-popup .ui-emoji-icon-picker__grid {
  padding-inline: 8px;
}
.web-emoji-icon-picker-quick-popup > div {
  border-radius: inherit;
  overflow: hidden;
}

/* apps/web/src/demos/component-thumbnails.css */

```

#### Footer composition

##### Actions

message-actions-21.jsx

```jsx
import { useState } from "react";
import { MessageActions } from "@/components/ui/message-actions";
import {
  Message,
  MessageBody,
  MessageContent,
  MessageFooter,
} from "@/components/ui/message";
import { CitationList, CitationProvider } from "@/components/ui/citation";

export default function Example() {
  const [vote, setVote] = useState(null);
  const [feedback, setFeedback] = useState("");
  const share = async () => {
    if (!navigator.share) {
      setFeedback("Sharing is not available in this browser.");
      return;
    }
    try {
      await navigator.share({
        title: "Rollout plan",
        text: "Move the rollout to Friday. Staging passed the retry check, and Priya owns the final coverage review.",
      });
    } catch {
      setFeedback("Sharing was cancelled.");
    }
  };
  const download = () => {
    const url = URL.createObjectURL(
      new Blob(
        [
          "Move the rollout to Friday. Staging passed the retry check, and Priya owns the final coverage review.",
        ],
        {
          type: "text/plain",
        },
      ),
    );
    const anchor = document.createElement("a");
    anchor.href = url;
    anchor.download = "rollout-answer.txt";
    anchor.click();
    URL.revokeObjectURL(url);
    setFeedback("Answer downloaded.");
  };
  return (
    <CitationProvider sources={sources} mode="provided">
      <div data-preview-wide>
        <Message actor="assistant">
          <MessageContent>
            <MessageBody>
              {
                "Move the rollout to Friday. Staging passed the retry check, and Priya owns the final coverage review."
              }
            </MessageBody>
            <MessageFooter>
              <MessageActions
                text={
                  "Move the rollout to Friday. Staging passed the retry check, and Priya owns the final coverage review."
                }
                vote={vote}
                onVote={setVote}
                onShare={() => void share()}
                onDownload={download}
                sources={<CitationList mode="provided" />}
              />
            </MessageFooter>
          </MessageContent>
        </Message>
        <span className="ui-sr-only" role="status">
          {feedback}
        </span>
      </div>
    </CitationProvider>
  );
}

var sources = [
  {
    id: "runbook",
    type: "url",
    title: "Release runbook",
    url: "https://example.com/runbook",
  },
  {
    id: "status",
    type: "url",
    title: "Staging status",
    url: "https://example.com/status",
  },
];

```

##### Reactions

Reaction selection and counts remain caller-owned. The picker opens from the aggregate reaction control.

message-reactions-22.jsx

```jsx
import * as React from "react";
import { SmilePlus } from "lucide-react";
import { EmojiIconPicker } from "@/components/ui/emoji-icon-picker";
import {
  createEmojiIconCatalog,
  recordEmojiIconUsage,
  resolveEmojiIcon,
} from "@/lib/emoji-icon-picker";
import { Popover } from "@/components/ui/popover";
import { Button, IconButton } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge";
import {
  Message,
  MessageBody,
  MessageContent,
  MessageMeta,
  MessageReactions,
  MessageToolbar,
} from "@/components/ui/message";
import { MessageActions } from "@/components/ui/message-actions";
import { Toolbar } from "@/components/ui/toolbar";

export default function Example2() {
  const [quickOpen, setQuickOpen] = React.useState(false);
  const fullRequested = React.useRef(false);
  const [open, setOpen] = React.useState(false);
  const [keyboardOpen, setKeyboardOpen] = React.useState(false);
  const message = React.useRef(null);
  const origin = React.useRef(null);
  const summary = React.useRef(null);
  const [usage, setUsage] = React.useState(reactionHistory);
  const [reactions, setReactions] = React.useState([
    {
      selection: {
        id: "+1",
      },
      count: 3,
    },
    {
      selection: {
        id: "sparkles",
      },
      count: 2,
    },
  ]);
  const [messageText, setMessageText] = React.useState(
    undefined
      ? "Can we move the rollout review to Friday?"
      : "I found 6 sources for the launch plan.",
  );
  const [editing, setEditing] = React.useState(false);
  const items = React.useMemo(
    () => [...demoItems, workspaceItems.find((item) => item.id === "orbit")],
    [],
  );
  const catalog = React.useMemo(() => createEmojiIconCatalog(items), [items]);
  const pick = (value, item) => {
    const selection = exactSelection(value, item);
    if (!selection) return;
    setUsage((current) => recordEmojiIconUsage(current, selection.id));
    setReactions((current) => {
      const matches = (reaction) =>
        reaction.selection.id === selection.id &&
        reaction.selection.variantId === selection.variantId;
      const existing = current.find(matches);
      if (!existing)
        return [
          ...current,
          {
            selection,
            count: 1,
          },
        ];
      return current.map((reaction) =>
        matches(reaction)
          ? {
              ...reaction,
              count: reaction.count + 1,
            }
          : reaction,
      );
    });
    setQuickOpen(false);
  };
  const reactionTotal = reactions.reduce(
    (sum, reaction) => sum + reaction.count,
    0,
  );
  const reactionLabels = reactions
    .map(
      (reaction) =>
        (resolveEmojiIcon(catalog, reaction.selection)?.label ?? "Reaction") +
        ": " +
        reaction.count,
    )
    .join(", ");
  const exampleName = undefined
    ? `footer-${undefined}-${"interaction"}`
    : "simple-count";
  const footer = (
    <MessageToolbar>
      <>
        <Toolbar.Group aria-label="Message metadata">
          <MessageMeta>
            <time dateTime="2026-11-09T10:24:00+07:00">10:24</time>
            {false}
          </MessageMeta>
        </Toolbar.Group>
        <Toolbar.Separator />
      </>
      <Toolbar.Group aria-label="Message actions">
        <MessageActions text={messageText} onEdit={undefined} />
        <Popover.Trigger
          render={
            <Toolbar.Button
              render={
                <IconButton
                  variant="ghost"
                  size="icon-sm"
                  aria-label="Add reaction"
                  icon={<SmilePlus />}
                />
              }
            />
          }
        />
      </Toolbar.Group>
      {reactions.length > 0 && <Toolbar.Separator />}
      {reactions.length > 0 && (
        <>
          <Toolbar.Group aria-label="Saved reactions">
            <MessageReactions
              aria-label="Message reactions"
              data-reaction-total={reactionTotal}
            >
              <Popover.Trigger
                ref={summary}
                render={
                  <Toolbar.Button
                    render={
                      <Button
                        type="button"
                        variant="ghost"
                        size="sm"
                        className="web-emoji-icon-picker-applied"
                        aria-label={`Choose a reaction. ${reactionLabels}; ${reactionTotal} total reactions`}
                        title="Choose a reaction"
                      />
                    }
                  />
                }
              >
                <span
                  className="web-emoji-icon-picker-applied-stack"
                  aria-hidden="true"
                >
                  {reactions.map((reaction) => {
                    const item = resolveEmojiIcon(catalog, reaction.selection);
                    return (
                      <span
                        key={
                          reaction.selection.id +
                          ":" +
                          (reaction.selection.variantId ?? "")
                        }
                      >
                        {item ? <Choice item={item} /> : null}
                      </span>
                    );
                  })}
                </span>
                <Badge
                  kind="counter"
                  size="sm"
                  className="web-emoji-icon-picker-applied-count"
                  aria-hidden="true"
                >
                  {reactionTotal}
                </Badge>
              </Popover.Trigger>
            </MessageReactions>
          </Toolbar.Group>
        </>
      )}
    </MessageToolbar>
  );
  return (
    <Example name={exampleName}>
      <Message
        ref={message}
        actor="user"
        actionsReveal={true}
        metadataAtRest={true}
        className="web-emoji-icon-picker-reaction-message"
      >
        <Popover.Root
          open={quickOpen}
          onOpenChange={(next, details) => {
            if (next && details.trigger instanceof HTMLButtonElement)
              origin.current = details.trigger;
            setQuickOpen(next);
          }}
          onOpenChangeComplete={(next) => {
            if (!next && fullRequested.current) {
              fullRequested.current = false;
              setOpen(true);
            }
          }}
        >
          <MessageContent>
            <MessageBody appearance="subtle">
              {messageText}
              {false}
            </MessageBody>
            {false}
          </MessageContent>
          {footer}
          <Popover.Portal>
            <Popover.Positioner
              side="bottom"
              align={"end"}
              sideOffset={8}
              collisionAvoidance={{
                side: "none",
                align: "shift",
              }}
            >
              <Popover.Popup
                className="web-emoji-icon-picker-quick-popup"
                finalFocus={() =>
                  fullRequested.current || open ? false : origin.current
                }
              >
                <Popover.Arrow />
                <div
                  className={"web-emoji-icon-picker-reaction-narrow"}
                  onKeyDownCapture={() => setKeyboardOpen(true)}
                  onPointerDownCapture={() => setKeyboardOpen(false)}
                >
                  <EmojiIconPicker.Simple
                    surface="inline"
                    items={items}
                    categories={demoCategories}
                    size={"base"}
                    usage={usage}
                    count={10}
                    order="recent"
                    onValueChange={pick}
                    onMore={() => {
                      fullRequested.current = true;
                      setQuickOpen(false);
                    }}
                  />
                </div>
              </Popover.Popup>
            </Popover.Positioner>
          </Popover.Portal>
        </Popover.Root>
      </Message>
      <EmojiIconPicker.Root
        open={open}
        onOpenChange={setOpen}
        items={items}
        categories={demoCategories}
        size={"base"}
        columns={6}
        onValueChange={pick}
      >
        <EmojiIconPicker.Popup
          aria-label="Choose a reaction"
          align="end"
          positionerProps={{
            anchor: () => summary.current ?? origin.current,
          }}
          finalFocus={() => summary.current ?? origin.current}
        >
          <CompleteParts />
        </EmojiIconPicker.Popup>
      </EmojiIconPicker.Root>
      {false}
    </Example>
  );
}

var orbit =
  "data:image/svg+xml," +
  encodeURIComponent(
    '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><rect x="1" y="1" width="30" height="30" rx="10" fill="#8C78EA"/><path d="M16 6l3 7 7 3-7 3-3 7-3-7-7-3 7-3z" fill="white"/></svg>',
  );

var rows = [
  ["\u{1F50E}", "Magnifying glass", "frequent", "mag", "#8aaab7"],
  ["\u{1F9E0}", "Brain", "frequent", "brain", "#d879a6"],
  ["\u2728", "Sparkles", "frequent", "sparkles", "#e5b832"],
  ["\u{1F916}", "Robot", "frequent", "robot", "#6aa3bb"],
  ["\u{1F4DA}", "Books", "frequent", "books", "#4caa75"],
  ["\u{1F4A1}", "Light bulb", "frequent", "bulb", "#e9bd38"],
  ["\u{1F52C}", "Microscope", "frequent", "microscope", "#6c9cac"],
  ["\u{1F680}", "Rocket", "frequent", "rocket", "#ec6f50"],
  ["\u{1F600}", "Grinning face", "smileys", "grinning"],
  ["\u{1F60A}", "Smiling face", "smileys", "blush"],
  ["\u{1F602}", "Tears of joy", "smileys", "joy"],
  ["\u{1F979}", "Holding back tears", "smileys", "holding_back_tears"],
  ["\u{1F60D}", "Heart eyes", "smileys", "heart_eyes"],
  ["\u{1F914}", "Thinking face", "smileys", "thinking"],
  ["\u{1F60E}", "Sunglasses", "smileys", "sunglasses"],
  ["\u{1F973}", "Partying face", "smileys", "partying_face"],
  ["\u{1F917}", "Hugging face", "smileys", "hugs"],
  ["\u{1F60C}", "Relieved face", "smileys", "relieved"],
  ["\u{1F929}", "Star eyes", "smileys", "star_struck"],
  ["\u{1F605}", "Grinning with sweat", "smileys", "sweat_smile"],
  ["\u{1F44B}", "Waving hand", "smileys", "wave"],
  ["\u{1F44D}", "Thumbs up", "smileys", "+1"],
  ["\u{1F64F}", "Folded hands", "smileys", "pray"],
  ["\u{1F4AA}", "Flexed biceps", "smileys", "muscle"],
  ["\u{1F3A8}", "Artist palette", "objects", "art"],
  ["\u{1F4DD}", "Memo", "objects", "memo"],
  ["\u{1F310}", "Globe", "objects", "globe_with_meridians"],
  ["\u{1F4CA}", "Bar chart", "objects", "bar_chart"],
  ["\u{1F4AC}", "Speech balloon", "objects", "speech_balloon"],
  ["\u2B50", "Star", "objects", "star"],
  ["\u{1F3AF}", "Direct hit", "objects", "dart"],
  ["\u2764\uFE0F", "Red heart", "reactions", "heart", "#e75b52"],
  ["\u{1F389}", "Party popper", "reactions", "tada", "#e5b832"],
  ["\u{1F440}", "Eyes", "reactions", "eyes"],
];

var demoItems = rows.map((row) => ({
  id: row[3],
  label: row[1],
  content: {
    type: "emoji",
    text: row[0],
  },
  category: row[2],
  shortcodes: [row[3]],
  keywords: [
    row[1],
    row[3].replaceAll("_", " "),
    ...(row[3] === "microscope" ? ["science", "research"] : []),
  ],
  accent:
    row.length > 4 ? row[4] : row[2] === "smileys" ? "#e7b52b" : undefined,
  ...(["wave", "+1", "pray", "muscle"].includes(row[3])
    ? {
        variants: [
          "\u{1F3FB}",
          "\u{1F3FC}",
          "\u{1F3FD}",
          "\u{1F3FE}",
          "\u{1F3FF}",
        ].map((modifier, index) => ({
          id: `tone-${index + 1}`,
          tone: index + 1,
          content: {
            type: "emoji",
            text: row[0] + modifier,
          },
        })),
      }
    : {}),
}));

var workspaceItems = [
  ...demoItems.filter(
    (item) => item.category === "frequent" || item.category === "smileys",
  ),
  {
    id: "orbit",
    label: "Orbit",
    content: {
      type: "image",
      src: orbit,
    },
    category: "objects",
    categories: ["custom"],
    shortcodes: ["orbit"],
    accent: "#8c78ea",
  },
  ...demoItems.filter((item) => item.category === "objects"),
];

var demoCategories = [
  {
    id: "frequent",
    label: "Frequently used",
  },
  {
    id: "smileys",
    label: "Smileys & people",
  },
  {
    id: "objects",
    label: "Workspace",
  },
  {
    id: "custom",
    label: "Custom",
  },
  {
    id: "reactions",
    label: "Reactions",
  },
];

function exactSelection(value, item) {
  return value && item?.variantId
    ? {
        id: value.id,
        variantId: item.variantId,
      }
    : value;
}

function Example({ name, children, className }) {
  return (
    <div
      className={["web-emoji-icon-picker-example", undefined]
        .filter(Boolean)
        .join(" ")}
      data-emoji-icon-case={"simple-count"}
    >
      {children}
    </div>
  );
}

function CompleteParts({ onRetry, searchPlacement = "top" } = {}) {
  const search = (
    <EmojiIconPicker.Search>
      <EmojiIconPicker.SkinTone />
    </EmojiIconPicker.Search>
  );
  const tabs = (
    <EmojiIconPicker.Tabs
      categoryIds={["smileys", "objects", "custom"]}
      renderLabel={(group) =>
        ({
          smileys: "Smileys",
          objects: "Objects",
          custom: "Custom",
        })[group.id] ?? group.label
      }
    />
  );
  const grid = (
    <EmojiIconPicker.CategoryPanel>
      <EmojiIconPicker.Grid labels onRetry={onRetry} />
    </EmojiIconPicker.CategoryPanel>
  );
  return searchPlacement === "bottom" ? (
    <>
      <EmojiIconPicker.Preview />
      {grid}
      {tabs}
      {search}
    </>
  ) : (
    <>
      {search}
      {tabs}
      {grid}
      <EmojiIconPicker.Preview />
    </>
  );
}

function Choice({ item, renderIcon }) {
  const content = item.content;
  return content.type === "emoji" ? (
    <>{content.text}</>
  ) : content.type === "image" ? (
    <img src={content.src} alt="" width="22" height="22" />
  ) : (
    <>{renderIcon?.(content, item)}</>
  );
}

var reactionHistory = /* @__PURE__ */ [
  "robot",
  "brain",
  "microscope",
  "sparkles",
  "rocket",
  "books",
  "globe_with_meridians",
  "memo",
  "heart",
  "+1",
].map((id, index) => ({
  id,
  count: 10 - index,
  lastUsedAt: 100 - index,
}));

```

message-reactions-22.css

```css
/* apps/web/src/demos/ui/emoji-icon-picker.css */
.web-emoji-icon-picker-example {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  min-width: 0;
  padding: 24px 12px;
}
.web-emoji-icon-picker-reaction-message {
  width: 344px;
  max-width: 100%;
}
.web-emoji-icon-picker-reaction-message .ui-message-footer {
  width: 100%;
}
.web-emoji-icon-picker-reaction-narrow {
  width: 216px;
  max-width: 100%;
}
.web-emoji-icon-picker-example[data-emoji-icon-case=preview] {
  min-height: 240px;
}
.ui-popover.web-emoji-icon-picker-quick-popup {
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 0;
  gap: 0;
  overflow: visible;
  transition: none;
}
.ui-button.web-emoji-icon-picker-applied {
  gap: var(--space-1);
  padding: 0 4px;
  border-radius: var(--radius-control-base);
}
.web-emoji-icon-picker-applied-stack {
  display: inline-flex;
  align-items: center;
}
.web-emoji-icon-picker-applied-stack > span {
  display: inline-flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 14px;
}
.web-emoji-icon-picker-applied-stack > span + span {
  margin-inline-start: -4px;
}
.web-emoji-icon-picker-applied-stack :is(img, svg) {
  width: 12px;
  height: 12px;
  object-fit: contain;
}
.ui-badge.web-emoji-icon-picker-applied-count {
  min-width: 0;
  height: 14px;
  padding-inline: 2px;
  font-size: 10px;
  line-height: 12px;
  font-weight: 400;
}
.web-emoji-icon-picker-example > .ui-emoji-icon-picker__trigger {
  align-self: center;
}
.web-emoji-icon-picker-quick-popup .ui-emoji-icon-picker__surface {
  width: 100%;
}
.web-emoji-icon-picker-quick-popup .ui-emoji-icon-picker__grid {
  padding-inline: 8px;
}
.web-emoji-icon-picker-quick-popup > div {
  border-radius: inherit;
  overflow: hidden;
}

```

##### Metadata

Supply only the time, receipt, and citations the host can verify. This example shows a short edited message and a wrapped message with only time and delivery inside the text flow; its commands and reaction stay outside the bubble.

message-metadata-23.jsx

```jsx
import { MessageActions as MessageActions2 } from "@/components/ui/message-actions";
import * as React2 from "react";
import { SmilePlus } from "lucide-react";
import { EmojiIconPicker } from "@/components/ui/emoji-icon-picker";
import {
  createEmojiIconCatalog,
  recordEmojiIconUsage,
  resolveEmojiIcon,
} from "@/lib/emoji-icon-picker";
import { Popover } from "@/components/ui/popover";
import { Button as Button2, IconButton } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge";
import {
  Message as Message2,
  MessageBody as MessageBody2,
  MessageContent,
  MessageFooter,
  MessageMeta,
  MessageReactions,
  MessageToolbar,
} from "@/components/ui/message";
import {
  MessageActions,
  MessageDelivery,
  MessageEdit,
} from "@/components/ui/message-actions";
import { Toolbar } from "@/components/ui/toolbar";
import { CitationList, CitationProvider } from "@/components/ui/citation";
import {
  Message as Message3,
  MessageBody as MessageBody3,
  MessageContent as MessageContent2,
  MessageFooter as MessageFooter2,
  MessageMeta as MessageMeta2,
} from "@/components/ui/message";

export default function Example2() {
  return (
    <CitationProvider sources={footerSources} mode="provided">
      <div
        data-preview-wide
        style={{
          display: "grid",
          gap: "var(--space-2)",
        }}
      >
        <Message3 actor="user" metadataAtRest>
          <MessageContent2>
            <MessageBody3 appearance="subtle">
              Can we move the rollout review to Friday?
              <MessageMeta2 placement="inline">
                <time dateTime="2026-11-09T09:42:00+07:00">9:42 AM</time>
                <span>Edited</span>
              </MessageMeta2>
            </MessageBody3>
          </MessageContent2>
        </Message3>
        <MessageFooterRecipeDemo
          position="inline"
          actionsReveal={false}
          metadataAtRest
          deliveryInBubble
        />
        <Message3 actor="assistant" metadataAtRest>
          <MessageContent2>
            <MessageBody3>
              The staging check passed and Priya owns the coverage review.
            </MessageBody3>
            <MessageFooter2>
              <MessageActions2
                text="The staging check passed and Priya owns the coverage review."
                timestamp="9:46 AM"
                sources={<CitationList mode="provided" />}
              />
            </MessageFooter2>
          </MessageContent2>
        </Message3>
      </div>
    </CitationProvider>
  );
}

var orbit =
  "data:image/svg+xml," +
  encodeURIComponent(
    '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><rect x="1" y="1" width="30" height="30" rx="10" fill="#8C78EA"/><path d="M16 6l3 7 7 3-7 3-3 7-3-7-7-3 7-3z" fill="white"/></svg>',
  );

var rows = [
  ["\u{1F50E}", "Magnifying glass", "frequent", "mag", "#8aaab7"],
  ["\u{1F9E0}", "Brain", "frequent", "brain", "#d879a6"],
  ["\u2728", "Sparkles", "frequent", "sparkles", "#e5b832"],
  ["\u{1F916}", "Robot", "frequent", "robot", "#6aa3bb"],
  ["\u{1F4DA}", "Books", "frequent", "books", "#4caa75"],
  ["\u{1F4A1}", "Light bulb", "frequent", "bulb", "#e9bd38"],
  ["\u{1F52C}", "Microscope", "frequent", "microscope", "#6c9cac"],
  ["\u{1F680}", "Rocket", "frequent", "rocket", "#ec6f50"],
  ["\u{1F600}", "Grinning face", "smileys", "grinning"],
  ["\u{1F60A}", "Smiling face", "smileys", "blush"],
  ["\u{1F602}", "Tears of joy", "smileys", "joy"],
  ["\u{1F979}", "Holding back tears", "smileys", "holding_back_tears"],
  ["\u{1F60D}", "Heart eyes", "smileys", "heart_eyes"],
  ["\u{1F914}", "Thinking face", "smileys", "thinking"],
  ["\u{1F60E}", "Sunglasses", "smileys", "sunglasses"],
  ["\u{1F973}", "Partying face", "smileys", "partying_face"],
  ["\u{1F917}", "Hugging face", "smileys", "hugs"],
  ["\u{1F60C}", "Relieved face", "smileys", "relieved"],
  ["\u{1F929}", "Star eyes", "smileys", "star_struck"],
  ["\u{1F605}", "Grinning with sweat", "smileys", "sweat_smile"],
  ["\u{1F44B}", "Waving hand", "smileys", "wave"],
  ["\u{1F44D}", "Thumbs up", "smileys", "+1"],
  ["\u{1F64F}", "Folded hands", "smileys", "pray"],
  ["\u{1F4AA}", "Flexed biceps", "smileys", "muscle"],
  ["\u{1F3A8}", "Artist palette", "objects", "art"],
  ["\u{1F4DD}", "Memo", "objects", "memo"],
  ["\u{1F310}", "Globe", "objects", "globe_with_meridians"],
  ["\u{1F4CA}", "Bar chart", "objects", "bar_chart"],
  ["\u{1F4AC}", "Speech balloon", "objects", "speech_balloon"],
  ["\u2B50", "Star", "objects", "star"],
  ["\u{1F3AF}", "Direct hit", "objects", "dart"],
  ["\u2764\uFE0F", "Red heart", "reactions", "heart", "#e75b52"],
  ["\u{1F389}", "Party popper", "reactions", "tada", "#e5b832"],
  ["\u{1F440}", "Eyes", "reactions", "eyes"],
];

var demoItems = rows.map((row) => ({
  id: row[3],
  label: row[1],
  content: {
    type: "emoji",
    text: row[0],
  },
  category: row[2],
  shortcodes: [row[3]],
  keywords: [
    row[1],
    row[3].replaceAll("_", " "),
    ...(row[3] === "microscope" ? ["science", "research"] : []),
  ],
  accent:
    row.length > 4 ? row[4] : row[2] === "smileys" ? "#e7b52b" : undefined,
  ...(["wave", "+1", "pray", "muscle"].includes(row[3])
    ? {
        variants: [
          "\u{1F3FB}",
          "\u{1F3FC}",
          "\u{1F3FD}",
          "\u{1F3FE}",
          "\u{1F3FF}",
        ].map((modifier, index) => ({
          id: `tone-${index + 1}`,
          tone: index + 1,
          content: {
            type: "emoji",
            text: row[0] + modifier,
          },
        })),
      }
    : {}),
}));

var workspaceItems = [
  ...demoItems.filter(
    (item) => item.category === "frequent" || item.category === "smileys",
  ),
  {
    id: "orbit",
    label: "Orbit",
    content: {
      type: "image",
      src: orbit,
    },
    category: "objects",
    categories: ["custom"],
    shortcodes: ["orbit"],
    accent: "#8c78ea",
  },
  ...demoItems.filter((item) => item.category === "objects"),
];

var demoCategories = [
  {
    id: "frequent",
    label: "Frequently used",
  },
  {
    id: "smileys",
    label: "Smileys & people",
  },
  {
    id: "objects",
    label: "Workspace",
  },
  {
    id: "custom",
    label: "Custom",
  },
  {
    id: "reactions",
    label: "Reactions",
  },
];

function exactSelection(value, item) {
  return value && item?.variantId
    ? {
        id: value.id,
        variantId: item.variantId,
      }
    : value;
}

function Example({ name, children, className }) {
  return (
    <div
      className={["web-emoji-icon-picker-example", undefined]
        .filter(Boolean)
        .join(" ")}
      data-emoji-icon-case={name}
    >
      {children}
    </div>
  );
}

function CompleteParts({ onRetry, searchPlacement = "top" } = {}) {
  const search = (
    <EmojiIconPicker.Search>
      <EmojiIconPicker.SkinTone />
    </EmojiIconPicker.Search>
  );
  const tabs = (
    <EmojiIconPicker.Tabs
      categoryIds={["smileys", "objects", "custom"]}
      renderLabel={(group) =>
        ({
          smileys: "Smileys",
          objects: "Objects",
          custom: "Custom",
        })[group.id] ?? group.label
      }
    />
  );
  const grid = (
    <EmojiIconPicker.CategoryPanel>
      <EmojiIconPicker.Grid labels onRetry={onRetry} />
    </EmojiIconPicker.CategoryPanel>
  );
  return searchPlacement === "bottom" ? (
    <>
      <EmojiIconPicker.Preview />
      {grid}
      {tabs}
      {search}
    </>
  ) : (
    <>
      {search}
      {tabs}
      {grid}
      <EmojiIconPicker.Preview />
    </>
  );
}

function Choice({ item, renderIcon }) {
  const content = item.content;
  return content.type === "emoji" ? (
    <>{content.text}</>
  ) : content.type === "image" ? (
    <img src={content.src} alt="" width="22" height="22" />
  ) : (
    <>{renderIcon?.(content, item)}</>
  );
}

var reactionHistory = /* @__PURE__ */ [
  "robot",
  "brain",
  "microscope",
  "sparkles",
  "rocket",
  "books",
  "globe_with_meridians",
  "memo",
  "heart",
  "+1",
].map((id, index) => ({
  id,
  count: 10 - index,
  lastUsedAt: 100 - index,
}));

function ReactionExample({
  presentation,
  count = 6,
  size = "base",
  metadata = false,
  deliveryInBubble = false,
  footerPosition,
  actionsReveal = true,
  metadataAtRest = true,
}) {
  const [quickOpen, setQuickOpen] = React2.useState(false);
  const fullRequested = React2.useRef(false);
  const [open, setOpen] = React2.useState(false);
  const [keyboardOpen, setKeyboardOpen] = React2.useState(false);
  const message = React2.useRef(null);
  const origin = React2.useRef(null);
  const summary = React2.useRef(null);
  const [usage, setUsage] = React2.useState(reactionHistory);
  const [reactions, setReactions] = React2.useState([
    {
      selection: {
        id: "+1",
      },
      count: 3,
    },
    {
      selection: {
        id: "sparkles",
      },
      count: 2,
    },
  ]);
  const [messageText, setMessageText] = React2.useState(
    deliveryInBubble
      ? "The review covered the delivery estimate, regional handoff, and the final two checks. I\u2019ve updated the timing after confirming the carrier window."
      : footerPosition
        ? "Can we move the rollout review to Friday?"
        : "I found 6 sources for the launch plan.",
  );
  const [editing, setEditing] = React2.useState(false);
  const items = React2.useMemo(
    () => [...demoItems, workspaceItems.find((item) => item.id === "orbit")],
    [],
  );
  const catalog = React2.useMemo(() => createEmojiIconCatalog(items), [items]);
  const pick = (value, item) => {
    const selection = exactSelection(value, item);
    if (!selection) return;
    setUsage((current) => recordEmojiIconUsage(current, selection.id));
    setReactions((current) => {
      const matches = (reaction) =>
        reaction.selection.id === selection.id &&
        reaction.selection.variantId === selection.variantId;
      const existing = current.find(matches);
      if (!existing)
        return [
          ...current,
          {
            selection,
            count: 1,
          },
        ];
      return current.map((reaction) =>
        matches(reaction)
          ? {
              ...reaction,
              count: reaction.count + 1,
            }
          : reaction,
      );
    });
    setQuickOpen(false);
  };
  const reactionTotal = reactions.reduce(
    (sum, reaction) => sum + reaction.count,
    0,
  );
  const reactionLabels = reactions
    .map(
      (reaction) =>
        (resolveEmojiIcon(catalog, reaction.selection)?.label ?? "Reaction") +
        ": " +
        reaction.count,
    )
    .join(", ");
  const exampleName = footerPosition
    ? `footer-${footerPosition}-${actionsReveal ? "interaction" : "persistent"}`
    : "floating-metadata";
  if (editing)
    return (
      <Example name={exampleName}>
        <MessageEdit
          defaultValue={messageText}
          originalText={messageText}
          originalAuthor="Rina"
          submitLabel="Save changes"
          onCancel={() => setEditing(false)}
          onSubmit={async (text) => {
            setMessageText(text);
            setEditing(false);
          }}
        />
      </Example>
    );
  const footer = (
    <MessageToolbar>
      {!deliveryInBubble && (
        <>
          <Toolbar.Group aria-label="Message metadata">
            <MessageMeta>
              <time dateTime="2026-11-09T10:24:00+07:00">10:24</time>
              <MessageDelivery
                delivery={{
                  status: "read",
                  recipients: [
                    {
                      id: "marta",
                      name: "Marta Chen",
                      sentAt: "2026-11-09T10:20:00+07:00",
                      deliveredAt: "2026-11-09T10:20:02+07:00",
                      readAt: "2026-11-09T10:23:00+07:00",
                    },
                  ],
                }}
              />
            </MessageMeta>
          </Toolbar.Group>
          <Toolbar.Separator />
        </>
      )}
      <Toolbar.Group aria-label="Message actions">
        <MessageActions text={messageText} onEdit={() => setEditing(true)} />
        <Popover.Trigger
          render={
            <Toolbar.Button
              render={
                <IconButton
                  variant="ghost"
                  size="icon-sm"
                  aria-label="Add reaction"
                  icon={<SmilePlus />}
                />
              }
            />
          }
        />
      </Toolbar.Group>
      {reactions.length > 0 && <Toolbar.Separator />}
      {reactions.length > 0 && (
        <>
          <Toolbar.Group aria-label="Saved reactions">
            <MessageReactions
              aria-label="Message reactions"
              data-reaction-total={reactionTotal}
            >
              <Popover.Trigger
                ref={summary}
                render={
                  <Toolbar.Button
                    render={
                      <Button2
                        type="button"
                        variant="ghost"
                        size="sm"
                        className="web-emoji-icon-picker-applied"
                        aria-label={`Choose a reaction. ${reactionLabels}; ${reactionTotal} total reactions`}
                        title="Choose a reaction"
                      />
                    }
                  />
                }
              >
                <span
                  className="web-emoji-icon-picker-applied-stack"
                  aria-hidden="true"
                >
                  {reactions.map((reaction) => {
                    const item = resolveEmojiIcon(catalog, reaction.selection);
                    return (
                      <span
                        key={
                          reaction.selection.id +
                          ":" +
                          (reaction.selection.variantId ?? "")
                        }
                      >
                        {item ? <Choice item={item} /> : null}
                      </span>
                    );
                  })}
                </span>
                <Badge
                  kind="counter"
                  size="sm"
                  className="web-emoji-icon-picker-applied-count"
                  aria-hidden="true"
                >
                  {reactionTotal}
                </Badge>
              </Popover.Trigger>
            </MessageReactions>
          </Toolbar.Group>
        </>
      )}
    </MessageToolbar>
  );
  return (
    <Example name={exampleName}>
      <Message2
        ref={message}
        actor="user"
        actionsReveal={actionsReveal}
        metadataAtRest={metadataAtRest}
        className="web-emoji-icon-picker-reaction-message"
      >
        <Popover.Root
          open={quickOpen}
          onOpenChange={(next, details) => {
            if (next && details.trigger instanceof HTMLButtonElement)
              origin.current = details.trigger;
            setQuickOpen(next);
          }}
          onOpenChangeComplete={(next) => {
            if (!next && fullRequested.current) {
              fullRequested.current = false;
              setOpen(true);
            }
          }}
        >
          <MessageContent>
            <MessageBody2 appearance="subtle">
              {messageText}
              {deliveryInBubble && true && (
                <MessageMeta placement="inline">
                  <time dateTime="2026-11-09T09:45:00+07:00">9:45 AM</time>
                  <MessageDelivery
                    delivery={{
                      status: "read",
                      recipients: [
                        {
                          id: "marta",
                          name: "Marta Chen",
                          sentAt: "2026-11-09T09:42:00+07:00",
                          deliveredAt: "2026-11-09T09:42:02+07:00",
                          readAt: "2026-11-09T09:44:00+07:00",
                        },
                      ],
                    }}
                  />
                </MessageMeta>
              )}
            </MessageBody2>
            {footerPosition === "inline" && (
              <MessageFooter>{footer}</MessageFooter>
            )}
          </MessageContent>
          {footerPosition === "floating"
            ? footer
            : !footerPosition
              ? footer
              : null}
          <Popover.Portal>
            <Popover.Positioner
              side="bottom"
              align={"end"}
              sideOffset={8}
              collisionAvoidance={{
                side: "none",
                align: "shift",
              }}
            >
              <Popover.Popup
                className="web-emoji-icon-picker-quick-popup"
                finalFocus={() =>
                  fullRequested.current || open ? false : origin.current
                }
              >
                <Popover.Arrow />
                <div
                  className={"web-emoji-icon-picker-reaction-narrow"}
                  onKeyDownCapture={() => setKeyboardOpen(true)}
                  onPointerDownCapture={() => setKeyboardOpen(false)}
                >
                  <EmojiIconPicker.Simple
                    surface="inline"
                    items={items}
                    categories={demoCategories}
                    size={"base"}
                    usage={usage}
                    count={6}
                    order="recent"
                    onValueChange={pick}
                    onMore={() => {
                      fullRequested.current = true;
                      setQuickOpen(false);
                    }}
                  />
                </div>
              </Popover.Popup>
            </Popover.Positioner>
          </Popover.Portal>
        </Popover.Root>
      </Message2>
      <EmojiIconPicker.Root
        open={open}
        onOpenChange={setOpen}
        items={items}
        categories={demoCategories}
        size={"base"}
        columns={6}
        onValueChange={pick}
      >
        <EmojiIconPicker.Popup
          aria-label="Choose a reaction"
          align="end"
          positionerProps={{
            anchor: () => summary.current ?? origin.current,
          }}
          finalFocus={() => summary.current ?? origin.current}
        >
          <CompleteParts />
        </EmojiIconPicker.Popup>
      </EmojiIconPicker.Root>
      {false}
    </Example>
  );
}

function MessageFooterRecipeDemo({
  position,
  actionsReveal,
  metadataAtRest = true,
  deliveryInBubble = false,
}) {
  return (
    <ReactionExample
      presentation="popup"
      count={6}
      metadata
      deliveryInBubble={deliveryInBubble}
      footerPosition={position}
      actionsReveal={actionsReveal}
      metadataAtRest={metadataAtRest}
    />
  );
}

var footerSources = [
  {
    id: "release-runbook",
    type: "url",
    title: "Release runbook",
    url: "https://example.com/runbook",
  },
];

```

message-metadata-23.css

```css
/* apps/web/src/demos/ui/voice-compositions.css */

/* apps/web/src/demos/ui/emoji-icon-picker.css */
.web-emoji-icon-picker-example {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  min-width: 0;
  padding: 24px 12px;
}
.web-emoji-icon-picker-reaction-message {
  width: 344px;
  max-width: 100%;
}
.web-emoji-icon-picker-reaction-message .ui-message-footer {
  width: 100%;
}
.web-emoji-icon-picker-reaction-narrow {
  width: 216px;
  max-width: 100%;
}
.web-emoji-icon-picker-example[data-emoji-icon-case=preview] {
  min-height: 240px;
}
.ui-popover.web-emoji-icon-picker-quick-popup {
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 0;
  gap: 0;
  overflow: visible;
  transition: none;
}
.ui-button.web-emoji-icon-picker-applied {
  gap: var(--space-1);
  padding: 0 4px;
  border-radius: var(--radius-control-base);
}
.web-emoji-icon-picker-applied-stack {
  display: inline-flex;
  align-items: center;
}
.web-emoji-icon-picker-applied-stack > span {
  display: inline-flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 14px;
}
.web-emoji-icon-picker-applied-stack > span + span {
  margin-inline-start: -4px;
}
.web-emoji-icon-picker-applied-stack :is(img, svg) {
  width: 12px;
  height: 12px;
  object-fit: contain;
}
.ui-badge.web-emoji-icon-picker-applied-count {
  min-width: 0;
  height: 14px;
  padding-inline: 2px;
  font-size: 10px;
  line-height: 12px;
  font-weight: 400;
}
.web-emoji-icon-picker-example > .ui-emoji-icon-picker__trigger {
  align-self: center;
}
.web-emoji-icon-picker-quick-popup .ui-emoji-icon-picker__surface {
  width: 100%;
}
.web-emoji-icon-picker-quick-popup .ui-emoji-icon-picker__grid {
  padding-inline: 8px;
}
.web-emoji-icon-picker-quick-popup > div {
  border-radius: inherit;
  overflow: hidden;
}

/* apps/web/src/demos/component-thumbnails.css */

```

##### Combined

message-combined-24.jsx

```jsx
import * as React from "react";
import { SmilePlus } from "lucide-react";
import { EmojiIconPicker } from "@/components/ui/emoji-icon-picker";
import {
  createEmojiIconCatalog,
  recordEmojiIconUsage,
  resolveEmojiIcon,
} from "@/lib/emoji-icon-picker";
import { Popover } from "@/components/ui/popover";
import { Button, IconButton } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge";
import {
  Message,
  MessageBody,
  MessageContent,
  MessageMeta,
  MessageReactions,
  MessageToolbar,
} from "@/components/ui/message";
import {
  MessageActions,
  MessageDelivery,
  MessageEdit,
} from "@/components/ui/message-actions";
import { Toolbar } from "@/components/ui/toolbar";

export default function Example2() {
  const [quickOpen, setQuickOpen] = React.useState(false);
  const fullRequested = React.useRef(false);
  const [open, setOpen] = React.useState(false);
  const [keyboardOpen, setKeyboardOpen] = React.useState(false);
  const message = React.useRef(null);
  const origin = React.useRef(null);
  const summary = React.useRef(null);
  const [usage, setUsage] = React.useState(reactionHistory);
  const [reactions, setReactions] = React.useState([
    {
      selection: {
        id: "+1",
      },
      count: 3,
    },
    {
      selection: {
        id: "sparkles",
      },
      count: 2,
    },
  ]);
  const [messageText, setMessageText] = React.useState(
    "Can we move the rollout review to Friday?",
  );
  const [editing, setEditing] = React.useState(false);
  const items = React.useMemo(
    () => [...demoItems, workspaceItems.find((item) => item.id === "orbit")],
    [],
  );
  const catalog = React.useMemo(() => createEmojiIconCatalog(items), [items]);
  const pick = (value, item) => {
    const selection = exactSelection(value, item);
    if (!selection) return;
    setUsage((current) => recordEmojiIconUsage(current, selection.id));
    setReactions((current) => {
      const matches = (reaction) =>
        reaction.selection.id === selection.id &&
        reaction.selection.variantId === selection.variantId;
      const existing = current.find(matches);
      if (!existing)
        return [
          ...current,
          {
            selection,
            count: 1,
          },
        ];
      return current.map((reaction) =>
        matches(reaction)
          ? {
              ...reaction,
              count: reaction.count + 1,
            }
          : reaction,
      );
    });
    setQuickOpen(false);
  };
  const reactionTotal = reactions.reduce(
    (sum, reaction) => sum + reaction.count,
    0,
  );
  const reactionLabels = reactions
    .map(
      (reaction) =>
        (resolveEmojiIcon(catalog, reaction.selection)?.label ?? "Reaction") +
        ": " +
        reaction.count,
    )
    .join(", ");
  if (editing)
    return (
      <Example name={"footer-floating-interaction"}>
        <MessageEdit
          defaultValue={messageText}
          originalText={messageText}
          originalAuthor="Rina"
          submitLabel="Save changes"
          onCancel={() => setEditing(false)}
          onSubmit={async (text) => {
            setMessageText(text);
            setEditing(false);
          }}
        />
      </Example>
    );
  const footer = (
    <MessageToolbar>
      <>
        <Toolbar.Group aria-label="Message metadata">
          <MessageMeta>
            <time dateTime="2026-11-09T10:24:00+07:00">10:24</time>
            <MessageDelivery
              delivery={{
                status: "read",
                recipients: [
                  {
                    id: "marta",
                    name: "Marta Chen",
                    sentAt: "2026-11-09T10:20:00+07:00",
                    deliveredAt: "2026-11-09T10:20:02+07:00",
                    readAt: "2026-11-09T10:23:00+07:00",
                  },
                ],
              }}
            />
          </MessageMeta>
        </Toolbar.Group>
        <Toolbar.Separator />
      </>
      <Toolbar.Group aria-label="Message actions">
        <MessageActions text={messageText} onEdit={() => setEditing(true)} />
        <Popover.Trigger
          render={
            <Toolbar.Button
              render={
                <IconButton
                  variant="ghost"
                  size="icon-sm"
                  aria-label="Add reaction"
                  icon={<SmilePlus />}
                />
              }
            />
          }
        />
      </Toolbar.Group>
      {reactions.length > 0 && <Toolbar.Separator />}
      {reactions.length > 0 && (
        <>
          <Toolbar.Group aria-label="Saved reactions">
            <MessageReactions
              aria-label="Message reactions"
              data-reaction-total={reactionTotal}
            >
              <Popover.Trigger
                ref={summary}
                render={
                  <Toolbar.Button
                    render={
                      <Button
                        type="button"
                        variant="ghost"
                        size="sm"
                        className="web-emoji-icon-picker-applied"
                        aria-label={`Choose a reaction. ${reactionLabels}; ${reactionTotal} total reactions`}
                        title="Choose a reaction"
                      />
                    }
                  />
                }
              >
                <span
                  className="web-emoji-icon-picker-applied-stack"
                  aria-hidden="true"
                >
                  {reactions.map((reaction) => {
                    const item = resolveEmojiIcon(catalog, reaction.selection);
                    return (
                      <span
                        key={
                          reaction.selection.id +
                          ":" +
                          (reaction.selection.variantId ?? "")
                        }
                      >
                        {item ? <Choice item={item} /> : null}
                      </span>
                    );
                  })}
                </span>
                <Badge
                  kind="counter"
                  size="sm"
                  className="web-emoji-icon-picker-applied-count"
                  aria-hidden="true"
                >
                  {reactionTotal}
                </Badge>
              </Popover.Trigger>
            </MessageReactions>
          </Toolbar.Group>
        </>
      )}
    </MessageToolbar>
  );
  return (
    <Example name={"footer-floating-interaction"}>
      <Message
        ref={message}
        actor="user"
        actionsReveal={true}
        metadataAtRest={true}
        className="web-emoji-icon-picker-reaction-message"
      >
        <Popover.Root
          open={quickOpen}
          onOpenChange={(next, details) => {
            if (next && details.trigger instanceof HTMLButtonElement)
              origin.current = details.trigger;
            setQuickOpen(next);
          }}
          onOpenChangeComplete={(next) => {
            if (!next && fullRequested.current) {
              fullRequested.current = false;
              setOpen(true);
            }
          }}
        >
          <MessageContent>
            <MessageBody appearance="subtle">
              {messageText}
              {false}
            </MessageBody>
            {false}
          </MessageContent>
          {footer}
          <Popover.Portal>
            <Popover.Positioner
              side="bottom"
              align={"end"}
              sideOffset={8}
              collisionAvoidance={{
                side: "none",
                align: "shift",
              }}
            >
              <Popover.Popup
                className="web-emoji-icon-picker-quick-popup"
                finalFocus={() =>
                  fullRequested.current || open ? false : origin.current
                }
              >
                <Popover.Arrow />
                <div
                  className={"web-emoji-icon-picker-reaction-narrow"}
                  onKeyDownCapture={() => setKeyboardOpen(true)}
                  onPointerDownCapture={() => setKeyboardOpen(false)}
                >
                  <EmojiIconPicker.Simple
                    surface="inline"
                    items={items}
                    categories={demoCategories}
                    size={"base"}
                    usage={usage}
                    count={6}
                    order="recent"
                    onValueChange={pick}
                    onMore={() => {
                      fullRequested.current = true;
                      setQuickOpen(false);
                    }}
                  />
                </div>
              </Popover.Popup>
            </Popover.Positioner>
          </Popover.Portal>
        </Popover.Root>
      </Message>
      <EmojiIconPicker.Root
        open={open}
        onOpenChange={setOpen}
        items={items}
        categories={demoCategories}
        size={"base"}
        columns={6}
        onValueChange={pick}
      >
        <EmojiIconPicker.Popup
          aria-label="Choose a reaction"
          align="end"
          positionerProps={{
            anchor: () => summary.current ?? origin.current,
          }}
          finalFocus={() => summary.current ?? origin.current}
        >
          <CompleteParts />
        </EmojiIconPicker.Popup>
      </EmojiIconPicker.Root>
      {false}
    </Example>
  );
}

var orbit =
  "data:image/svg+xml," +
  encodeURIComponent(
    '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><rect x="1" y="1" width="30" height="30" rx="10" fill="#8C78EA"/><path d="M16 6l3 7 7 3-7 3-3 7-3-7-7-3 7-3z" fill="white"/></svg>',
  );

var rows = [
  ["\u{1F50E}", "Magnifying glass", "frequent", "mag", "#8aaab7"],
  ["\u{1F9E0}", "Brain", "frequent", "brain", "#d879a6"],
  ["\u2728", "Sparkles", "frequent", "sparkles", "#e5b832"],
  ["\u{1F916}", "Robot", "frequent", "robot", "#6aa3bb"],
  ["\u{1F4DA}", "Books", "frequent", "books", "#4caa75"],
  ["\u{1F4A1}", "Light bulb", "frequent", "bulb", "#e9bd38"],
  ["\u{1F52C}", "Microscope", "frequent", "microscope", "#6c9cac"],
  ["\u{1F680}", "Rocket", "frequent", "rocket", "#ec6f50"],
  ["\u{1F600}", "Grinning face", "smileys", "grinning"],
  ["\u{1F60A}", "Smiling face", "smileys", "blush"],
  ["\u{1F602}", "Tears of joy", "smileys", "joy"],
  ["\u{1F979}", "Holding back tears", "smileys", "holding_back_tears"],
  ["\u{1F60D}", "Heart eyes", "smileys", "heart_eyes"],
  ["\u{1F914}", "Thinking face", "smileys", "thinking"],
  ["\u{1F60E}", "Sunglasses", "smileys", "sunglasses"],
  ["\u{1F973}", "Partying face", "smileys", "partying_face"],
  ["\u{1F917}", "Hugging face", "smileys", "hugs"],
  ["\u{1F60C}", "Relieved face", "smileys", "relieved"],
  ["\u{1F929}", "Star eyes", "smileys", "star_struck"],
  ["\u{1F605}", "Grinning with sweat", "smileys", "sweat_smile"],
  ["\u{1F44B}", "Waving hand", "smileys", "wave"],
  ["\u{1F44D}", "Thumbs up", "smileys", "+1"],
  ["\u{1F64F}", "Folded hands", "smileys", "pray"],
  ["\u{1F4AA}", "Flexed biceps", "smileys", "muscle"],
  ["\u{1F3A8}", "Artist palette", "objects", "art"],
  ["\u{1F4DD}", "Memo", "objects", "memo"],
  ["\u{1F310}", "Globe", "objects", "globe_with_meridians"],
  ["\u{1F4CA}", "Bar chart", "objects", "bar_chart"],
  ["\u{1F4AC}", "Speech balloon", "objects", "speech_balloon"],
  ["\u2B50", "Star", "objects", "star"],
  ["\u{1F3AF}", "Direct hit", "objects", "dart"],
  ["\u2764\uFE0F", "Red heart", "reactions", "heart", "#e75b52"],
  ["\u{1F389}", "Party popper", "reactions", "tada", "#e5b832"],
  ["\u{1F440}", "Eyes", "reactions", "eyes"],
];

var demoItems = rows.map((row) => ({
  id: row[3],
  label: row[1],
  content: {
    type: "emoji",
    text: row[0],
  },
  category: row[2],
  shortcodes: [row[3]],
  keywords: [
    row[1],
    row[3].replaceAll("_", " "),
    ...(row[3] === "microscope" ? ["science", "research"] : []),
  ],
  accent:
    row.length > 4 ? row[4] : row[2] === "smileys" ? "#e7b52b" : undefined,
  ...(["wave", "+1", "pray", "muscle"].includes(row[3])
    ? {
        variants: [
          "\u{1F3FB}",
          "\u{1F3FC}",
          "\u{1F3FD}",
          "\u{1F3FE}",
          "\u{1F3FF}",
        ].map((modifier, index) => ({
          id: `tone-${index + 1}`,
          tone: index + 1,
          content: {
            type: "emoji",
            text: row[0] + modifier,
          },
        })),
      }
    : {}),
}));

var workspaceItems = [
  ...demoItems.filter(
    (item) => item.category === "frequent" || item.category === "smileys",
  ),
  {
    id: "orbit",
    label: "Orbit",
    content: {
      type: "image",
      src: orbit,
    },
    category: "objects",
    categories: ["custom"],
    shortcodes: ["orbit"],
    accent: "#8c78ea",
  },
  ...demoItems.filter((item) => item.category === "objects"),
];

var demoCategories = [
  {
    id: "frequent",
    label: "Frequently used",
  },
  {
    id: "smileys",
    label: "Smileys & people",
  },
  {
    id: "objects",
    label: "Workspace",
  },
  {
    id: "custom",
    label: "Custom",
  },
  {
    id: "reactions",
    label: "Reactions",
  },
];

function exactSelection(value, item) {
  return value && item?.variantId
    ? {
        id: value.id,
        variantId: item.variantId,
      }
    : value;
}

function Example({ name, children, className }) {
  return (
    <div
      className={["web-emoji-icon-picker-example", undefined]
        .filter(Boolean)
        .join(" ")}
      data-emoji-icon-case={"footer-floating-interaction"}
    >
      {children}
    </div>
  );
}

function CompleteParts({ onRetry, searchPlacement = "top" } = {}) {
  const search = (
    <EmojiIconPicker.Search>
      <EmojiIconPicker.SkinTone />
    </EmojiIconPicker.Search>
  );
  const tabs = (
    <EmojiIconPicker.Tabs
      categoryIds={["smileys", "objects", "custom"]}
      renderLabel={(group) =>
        ({
          smileys: "Smileys",
          objects: "Objects",
          custom: "Custom",
        })[group.id] ?? group.label
      }
    />
  );
  const grid = (
    <EmojiIconPicker.CategoryPanel>
      <EmojiIconPicker.Grid labels onRetry={onRetry} />
    </EmojiIconPicker.CategoryPanel>
  );
  return searchPlacement === "bottom" ? (
    <>
      <EmojiIconPicker.Preview />
      {grid}
      {tabs}
      {search}
    </>
  ) : (
    <>
      {search}
      {tabs}
      {grid}
      <EmojiIconPicker.Preview />
    </>
  );
}

function Choice({ item, renderIcon }) {
  const content = item.content;
  return content.type === "emoji" ? (
    <>{content.text}</>
  ) : content.type === "image" ? (
    <img src={content.src} alt="" width="22" height="22" />
  ) : (
    <>{renderIcon?.(content, item)}</>
  );
}

var reactionHistory = /* @__PURE__ */ [
  "robot",
  "brain",
  "microscope",
  "sparkles",
  "rocket",
  "books",
  "globe_with_meridians",
  "memo",
  "heart",
  "+1",
].map((id, index) => ({
  id,
  count: 10 - index,
  lastUsedAt: 100 - index,
}));

```

message-combined-24.css

```css
/* apps/web/src/demos/ui/emoji-icon-picker.css */
.web-emoji-icon-picker-example {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  min-width: 0;
  padding: 24px 12px;
}
.web-emoji-icon-picker-reaction-message {
  width: 344px;
  max-width: 100%;
}
.web-emoji-icon-picker-reaction-message .ui-message-footer {
  width: 100%;
}
.web-emoji-icon-picker-reaction-narrow {
  width: 216px;
  max-width: 100%;
}
.web-emoji-icon-picker-example[data-emoji-icon-case=preview] {
  min-height: 240px;
}
.ui-popover.web-emoji-icon-picker-quick-popup {
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 0;
  gap: 0;
  overflow: visible;
  transition: none;
}
.ui-button.web-emoji-icon-picker-applied {
  gap: var(--space-1);
  padding: 0 4px;
  border-radius: var(--radius-control-base);
}
.web-emoji-icon-picker-applied-stack {
  display: inline-flex;
  align-items: center;
}
.web-emoji-icon-picker-applied-stack > span {
  display: inline-flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 14px;
}
.web-emoji-icon-picker-applied-stack > span + span {
  margin-inline-start: -4px;
}
.web-emoji-icon-picker-applied-stack :is(img, svg) {
  width: 12px;
  height: 12px;
  object-fit: contain;
}
.ui-badge.web-emoji-icon-picker-applied-count {
  min-width: 0;
  height: 14px;
  padding-inline: 2px;
  font-size: 10px;
  line-height: 12px;
  font-weight: 400;
}
.web-emoji-icon-picker-example > .ui-emoji-icon-picker__trigger {
  align-self: center;
}
.web-emoji-icon-picker-quick-popup .ui-emoji-icon-picker__surface {
  width: 100%;
}
.web-emoji-icon-picker-quick-popup .ui-emoji-icon-picker__grid {
  padding-inline: 8px;
}
.web-emoji-icon-picker-quick-popup > div {
  border-radius: inherit;
  overflow: hidden;
}

```

### Edit handoff

Message supplies the authored item. The [Message actions edit example](/ai-elements/message-actions#edit) shows a caller-owned edit and linked-reply regeneration transaction; [Composer](/ai-elements/composer#message-edit) supplies the edit surface. A targeted edit changes the selected human item and its explicitly linked AI reply, preserving every later visible message. A whole-conversation fork is a separate host feature. No backend deletion or model call is implied by the deterministic example.

### Delivery and generation

Generation is a Message status, while sending and delivery are host facts. Use Conversation for streaming, stop, following, and history. Use MessageActions for truthful receipts and outgoing Retry/Delete callbacks. No receipt is inferred from a status.

#### Sending voice message

A delivery retry resends the voice message; transcript retry only requests transcription.

message-sending-voice-message-25.jsx

```jsx
import * as React from "react";
import { ChevronDown } from "lucide-react";
import { AudioPlayer, useAudioPlayer } from "@/components/ui/audio-player";
import { Button } from "@/components/ui/button";
import { Collapsible } from "@/components/ui/collapsible";
import { Message, MessageBody } from "@/components/ui/message";
import { Transcript } from "@/components/ui/transcript";

export default function Example() {
  const [delivery, setDelivery] = React.useState("error");
  return (
    <VoiceMessageExample
      delivery={delivery}
      onRetryDelivery={() => setDelivery("complete")}
    />
  );
}

function RecordedTranscript() {
  const player = useAudioPlayer();
  return (
    <Transcript
      segments={[
        {
          id: "response",
          text: "\u201CThe Metal Forest is in the Great Domed Cavern, the largest in all our dominions,\u201D replied Kaliko.",
          start: 0,
          end: player.duration || undefined,
          status: "final",
        },
      ]}
    />
  );
}

function VoiceMessageExample({
  transcriptStatus = "ready",
  onRetryTranscript,
  delivery = "complete",
  onRetryDelivery,
}) {
  return (
    <div className="voice-composition">
      <Message actor="user" status={delivery} aria-label="Voice note">
        <VoiceMessageContent
          transcriptStatus={"ready"}
          onRetryTranscript={undefined}
          delivery={delivery}
          onRetryDelivery={onRetryDelivery}
        />
      </Message>
    </div>
  );
}

function VoiceMessageContent({
  transcriptStatus = "ready",
  onRetryTranscript,
  delivery = "complete",
  onRetryDelivery,
}) {
  return (
    <MessageBody>
      <AudioPlayer.Root src={"/audio/the-metal-forest.mp3"} label="Voice note">
        <AudioPlayer.ControlBar>
          <AudioPlayer.PlayPause />
          <AudioPlayer.Seek />
          <AudioPlayer.Time />
          <AudioPlayer.Speed />
        </AudioPlayer.ControlBar>
        <Collapsible.Root
          variant="plain"
          defaultOpen={transcriptStatus !== "ready"}
          style={{
            gap: "var(--space-1)",
          }}
        >
          <Collapsible.Trigger
            render={
              <Button
                type="button"
                variant="text"
                size="xs"
                className="voice-transcript-trigger"
              />
            }
            indicator={
              <Collapsible.Indicator>
                <ChevronDown size={12} />
              </Collapsible.Indicator>
            }
          >
            Transcript
          </Collapsible.Trigger>
          <Collapsible.Panel>
            {transcriptStatus === "ready" ? (
              <RecordedTranscript />
            ) : transcriptStatus === "pending" ? (
              <p className="voice-composition__draft" role="status">
                Transcribing…
              </p>
            ) : (
              <div className="voice-composition__feedback" role="alert">
                <p>Transcript unavailable.</p>
                {onRetryTranscript && (
                  <Button
                    type="button"
                    variant="ghost"
                    size="xs"
                    onClick={onRetryTranscript}
                  >
                    Retry transcript
                  </Button>
                )}
              </div>
            )}
          </Collapsible.Panel>
        </Collapsible.Root>
      </AudioPlayer.Root>
      {delivery === "queued" && (
        <p className="voice-composition__draft" role="status">
          Sending…
        </p>
      )}
      {delivery === "error" && (
        <div className="voice-composition__feedback" role="alert">
          <p>Message could not be sent.</p>
          {onRetryDelivery && (
            <Button
              type="button"
              variant="ghost"
              size="xs"
              onClick={onRetryDelivery}
            >
              Retry message
            </Button>
          )}
        </div>
      )}
    </MessageBody>
  );
}

```

message-sending-voice-message-25.css

```css
/* apps/web/src/demos/ui/voice-compositions.css */
.voice-composition {
  width: min(100%, 520px);
  min-width: 0;
  color: var(--foreground);
  font: var(--font-size-base)/var(--leading-copy) var(--font-sans);
}
.voice-composition .ui-message-body {
  min-width: 0;
}
.voice-composition__feedback {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--muted-foreground);
}
.voice-composition__feedback p {
  margin: 0;
}
.voice-composition__draft {
  margin: 0;
  color: var(--muted-foreground);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

```

Message status marks one authored item as queued, streaming, complete, stopped, or error. The full stop/follow interaction belongs to [Conversation](/ai-elements/conversation#stream-stop); truthful receipt details and failed-send recovery belong to [MessageActions](/ai-elements/message-actions#delivery).

## API reference

### Message

Message properties

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| actor (required) | ChatActor | — | Required author role: user, assistant, or system. |
| senderId | string | — | Optional stable participant identity. Adjacent messages group only when actor, senderId and alignment match. |
| status | MessageStatus | complete | Reports queued, streaming, complete, stopped, or error status. |
| align | start \| end \| center | actor-and-self-derived | Sets placement independently of actor. Defaults to start for assistant, system, and incoming humans; own user messages default to end. |
| actionsReveal | boolean | actor/self-derived | Explicit values override Conversation context. Standalone human messages reveal commands on interaction; assistant and system messages keep them persistent. |
| metadataAtRest | boolean | actor/self-derived | Explicit values override Conversation context. Supplied metadata persists for assistant, system, and incoming human messages; own-human metadata reveals on interaction. Independent of actionsReveal. |
| self | boolean | true | Identifies an own user message. Set false for another human; this does not change actor. |
| expanded / defaultExpanded / onExpandedChange | boolean / boolean / (expanded: boolean) => void | false | Controls the local Show more disclosure for overflowing human-sent content when MessageContent.maxLines is set. Agent and system content stays expanded. |
| groupPosition | single \| first \| middle \| last | single | Sets transcript spacing; an explicit value overrides MessageGroup context. |
| label | string | — | Provides the accessible name when native naming props are absent. |
| children | ReactNode | — | Renders caller-owned parts or legacy flat children in supplied order. |
| ...articleProps | ComponentPropsWithoutRef<'article'> | — | Forwards native article attributes and aria naming props; the component forwards its ref to the article. |

### Message parts

Message parts

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| MessageContent | div part | — | Groups optional header, body, and footer in a vertical region. maxLines applies only to this part when it contains the selected text; keep metadata and essential disclosure controls outside it. Accepts native div props and ref. |
| MessageContent.maxLines | number | — | Opt-in line limit for human-sent text. The examples use six lines; agent and system content stays fully visible. Put only the text or rich-text region here, outside files, players, transcripts, metadata, and the disclosure. |
| MessageExpandButton | Button props + HTMLButtonElement ref | — | Shows 10px/14px Show more or Show less text with a trailing 12px chevron when the paired human MessageContent exceeds maxLines. Keep this essential control visible outside the clamped text and any reveal-only metadata wrapper. |
| MessageMeta | div part; span when placement is inline | — | Composes caller-owned timestamp or delivery metadata. placement defaults to footer; inline is a text-flow tail and reserves its rendered width. Inside Message it follows explicit metadataAtRest, Conversation context, then the actor/self-derived fallback; outside Message it stays visible. |
| MessageAvatar | div part | — | Use as a direct sibling of MessageContent for the fixed identity lane; accepts native div props and ref. |
| MessageHeader | div part; optional render element | — | Accepts native div props and ref. Pass render={<ActivityTitle />} to compose the same identity into an inline Activity row; refs, classes, style, and native handlers merge with the render element, and Conversation identity hiding still applies. |
| MessageParts.activityLabel | ReactNode | — | Places a caller-owned identity label in the first default-rendered Activity summary or line. Conversation uses MessageHeader here so its roster identity and hide rules remain authoritative. |
| MessageFooter / MessageAttachments | div part | — | Optional caller-owned regions; accept native div props and ref. |
| MessageBody.appearance | plain \| subtle \| subtle-alt \| muted \| tinted \| solid \| outline \| critical | actor-derived | Chooses the body surface. Own user messages default to subtle, other user messages to subtle-alt, and assistant/system messages to plain. muted and tinted remain compatibility aliases. |
| MessageBody.actor | ChatActor | — | Overrides inherited actor only for body appearance and data. |
| MessageBody.children | ReactNode | — | Caller-owned text, rich media, attachments, replies, or MessageReactions. |

MessageBody accepts native div attributes and an HTMLDivElement ref. MessageAttachments, MessageFooter, MessageAvatar, MessageContent, and MessageReactions also forward native div attributes and HTMLDivElement refs. MessageHeader accepts div props through Base UI useRender, with a ref typed HTMLElement; its render element receives merged props/ref, and the default element is a div. MessageMeta accepts div attributes with footer placement and span attributes with inline placement; its forwarded ref is typed HTMLElement. MessageExpandButton accepts the shared Button props and button ref, defaulting to size="xs" and variant="text". MessageGroup accepts div props but does not forward a ref. MessageGroupProvider is a context provider, not a DOM wrapper: it requires groupPosition, optionally accepts presentation and children, and accepts no native element props or ref. MessageToolbar uses Base UI Toolbar.Root props/ref; the installed Toolbar declarations include native div props and the compositional render prop.

### Grouping and reactions

Grouping and reaction properties

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| MessageGroup.children | ReactNode | — | Groups adjacent direct Message children only when actor, senderId and effective alignment match; any other child breaks adjacency. |
| MessageReactions.side | top \| bottom | bottom | Places caller-provided controls above or below the relative MessageBody. |
| MessageReactions.align | start \| end | Message alignment; end outside Message | Follows the Message edge unless explicitly overridden. Inside MessageToolbar the region stays inline, with no second border. |
| MessageToolbar | Toolbar.Root props + HTMLDivElement ref | — | Canonical Toolbar with message-edge placement in a 32px capsule with 12px radius. Saved reactions and supplied metadata follow their own persistence policy. Message.actionsReveal controls commands; Message.metadataAtRest controls time, receipts, and citations. MessageActions joins Toolbar navigation. |
| MessageReactions.children | ReactNode | — | Caller-owned controls such as Buttons with accessible names, aria-pressed state, and counts. |
