# Message

A conversation row for avatars, message surfaces, sender context, and metadata.

Message lays out one conversational entry. It owns the row, avatar, sender context, and footer while leaving the visible message surface to [Bubble](/components/bubble/).

```tsx
import { Avatar, Bubble, Message, Text } from "@zentara-co/zenos-ui";

function MessageExample() {
  return (
    <Message.Group role="log" aria-label="Release conversation" className="w-full max-w-lg">
      <Message align="end">
        <Message.Avatar>
          <Avatar name="You" size="sm" tooltip={false} />
        </Message.Avatar>
        <Message.Content>
          <Bubble align="end">
            <Bubble.Content>Deploying the release now.</Bubble.Content>
          </Bubble>
          <Message.Footer>
            <Text size="s" color="subtle">
              Delivered
            </Text>
          </Message.Footer>
        </Message.Content>
      </Message>
      <Message>
        <Message.Avatar>
          <Avatar name="Rina" size="sm" tooltip={false} />
        </Message.Avatar>
        <Message.Content>
          <Message.Header>
            <Text size="s" weight="medium">
              Rina
            </Text>
          </Message.Header>
          <Bubble variant="secondary">
            <Bubble.Content>Send me the build report when it finishes.</Bubble.Content>
          </Bubble>
          <Message.Footer>
            <Text size="s" color="subtle">
              14:42
            </Text>
          </Message.Footer>
        </Message.Content>
      </Message>
    </Message.Group>
  );
}
```

## Import

```tsx
import { Avatar, Bubble, Message } from "@zentara-co/zenos-ui";
```

## Composition

Compose an optional avatar beside `Message.Content`. Place `Message.Header`, a Bubble, and `Message.Footer` inside the content column.

```tsx
<Message>
  <Message.Avatar>
    <Avatar name="Rina" size="sm" />
  </Message.Avatar>
  <Message.Content>
    <Message.Header>Rina</Message.Header>
    <Bubble variant="secondary">
      <Bubble.Content>The report is ready.</Bubble.Content>
    </Bubble>
    <Message.Footer>Read</Message.Footer>
  </Message.Content>
</Message>
```

Message is a presentational row rather than a transcript or scroll container. Put conversation-level semantics such as `role="log"` and an accessible label on the surrounding region.

## Alignment and RTL

Set `align="start"` or `align="end"` on Message to move the avatar to the matching logical side. Give the composed Bubble the same alignment when its surface should follow the row. Logical layout automatically mirrors in an RTL document or `DirectionProvider`.

```tsx
<Message align="end">
  <Message.Avatar>
    <Avatar name="You" size="sm" />
  </Message.Avatar>
  <Message.Content>
    <Bubble align="end">
      <Bubble.Content>Deploying now.</Bubble.Content>
    </Bubble>
    <Message.Footer>Delivered</Message.Footer>
  </Message.Content>
</Message>
```

## Consecutive messages

Use `Message.Group` for consecutive entries. An empty avatar slot on earlier messages preserves alignment when the final message displays the sender avatar.

```tsx
import { Avatar, Bubble, Message, Text } from "@zentara-co/zenos-ui";

function MessageGroupExample() {
  return (
    <Message.Group className="w-full max-w-lg gap-2">
      <Message>
        <Message.Avatar aria-hidden="true" className="size-8" />
        <Message.Content>
          <Bubble variant="secondary">
            <Bubble.Content>I checked the registry output.</Bubble.Content>
          </Bubble>
        </Message.Content>
      </Message>
      <Message>
        <Message.Avatar>
          <Avatar name="Chen" size="sm" tooltip={false} />
        </Message.Avatar>
        <Message.Content>
          <Bubble variant="secondary">
            <Bubble.Content>The component metadata is up to date.</Bubble.Content>
          </Bubble>
          <Message.Footer>
            <Text size="s" color="subtle">
              Read
            </Text>
          </Message.Footer>
        </Message.Content>
      </Message>
    </Message.Group>
  );
}
```

## Header and footer

Use `Message.Header` for sender context. Use `Message.Footer` for timestamps, delivery status, or message-level actions. End-aligned rows place footer content on the logical end automatically.

## Anatomy

```text
Message.Root
Message.Group
Message.Avatar
Message.Content
Message.Header
Message.Footer
```

## API

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| align | start \| end | start | Logical alignment of the message row and avatar. |
| Group | HTMLAttributes<HTMLDivElement> | — | Stacks consecutive messages from the same conversation. |
| Avatar | HTMLAttributes<HTMLDivElement> | — | Bottom-aligned slot for an Avatar or another sender marker. |
| Content | HTMLAttributes<HTMLDivElement> | — | Wraps the header, message surface, and footer. |
| Header / Footer | HTMLAttributes<HTMLDivElement> | — | Sender context and message-level metadata or actions. |
| native props | React.HTMLAttributes<HTMLDivElement> | — | Forwards native attributes, events, aria-*, data-*, className, style, and ref. |

Unless narrowed above, each DOM-rendering part also accepts its underlying native or Base UI props, including className, style, aria-*, and data-*.

## Accessibility

Message does not add chat semantics by itself. Keep sender names and status text meaningful, label icon-only footer actions, and use a live region only for updates that should be announced. Do not rely on alignment or color alone to identify the sender.

Source: https://zenos-ui.pages.dev/components/message/