# Message

Lays out one turn in a conversation, with an avatar, a header, the message content, a footer and alignment.

```tsx
import { Avatar, AvatarFallback } from "@/components/ui/avatar"
import { Bubble, BubbleContent, BubbleGroup, BubbleReactions } from "@/components/ui/bubble"
import { Marker, MarkerContent } from "@/components/ui/marker"
import { Message, MessageAvatar, MessageContent, MessageFooter } from "@/components/ui/message"
import { VStack } from "@/components/ui/stack"
import { shimmerStyles } from "@/lib/shimmer"
import { widths } from "@/theme/widths"

export default function MessageDemo() {
  return (
    <VStack gap={6} xstyle={widths.sm}>
      <Message align="end">
        <MessageAvatar>
          <Avatar>
            <AvatarFallback>ME</AvatarFallback>
          </Avatar>
        </MessageAvatar>
        <MessageContent>
          <Bubble>
            <BubbleContent>I&apos;m merging the parser fix now.</BubbleContent>
          </Bubble>
        </MessageContent>
      </Message>
      <Message>
        <MessageAvatar>
          <Avatar>
            <AvatarFallback>GH</AvatarFallback>
          </Avatar>
        </MessageAvatar>
        <MessageContent>
          <Bubble variant="secondary">
            <BubbleContent>Did the fuzz tests run on it?</BubbleContent>
          </Bubble>
        </MessageContent>
      </Message>
      <Message align="end">
        <MessageAvatar>
          <Avatar>
            <AvatarFallback>ME</AvatarFallback>
          </Avatar>
        </MessageAvatar>
        <MessageContent>
          <Bubble>
            <BubbleContent>For an hour, with no failures.</BubbleContent>
          </Bubble>
        </MessageContent>
        <MessageFooter>Delivered</MessageFooter>
      </Message>
      <Message>
        <MessageAvatar>
          <Avatar>
            <AvatarFallback>GH</AvatarFallback>
          </Avatar>
        </MessageAvatar>
        <MessageContent>
          <BubbleGroup>
            <Bubble variant="secondary">
              <BubbleContent>Good. An hour is enough for this one.</BubbleContent>
            </Bubble>
            <Bubble variant="secondary">
              <BubbleContent>Merge it, and I&apos;ll watch the nightly run.</BubbleContent>
              <BubbleReactions role="img" aria-label="Reaction: thumbs up">
                <span>👍</span>
              </BubbleReactions>
            </Bubble>
          </BubbleGroup>
        </MessageContent>
      </Message>
      <Marker role="status">
        <MarkerContent xstyle={shimmerStyles.base}>Grace is typing...</MarkerContent>
      </Marker>
    </VStack>
  )
}
```

`Message` lays out one turn: the avatar, the side, a header above the content
and a footer below it. The content itself is usually a
[Bubble](https://www.arene.style/docs/components/bubble), which is only the surface. An assistant's
reply, a reasoning step or a tool call can sit in the same place.

## Installation

**Command**

```bash
npx shadcn@latest add @arene/message
```

Needs the [arene setup](https://www.arene.style/docs/installation) first. Also adds [Bubble](https://www.arene.style/docs/components/bubble) and [Stack](https://www.arene.style/docs/components/stack).

**Manual**

1. Install the packages it imports:

   ```bash
   npm install @base-ui/react @stylexjs/stylex clsx
   ```

2. Set up the token layer and the StyleX compiler, if you have not already. See
   [Installation](https://www.arene.style/docs/installation). The message builds on
   [Bubble](https://www.arene.style/docs/components/bubble) and [Stack](https://www.arene.style/docs/components/stack), so
   paste those first. The examples put an [Avatar](https://www.arene.style/docs/components/avatar) in
   the avatar slot.

3. Paste this source into the file named in its title.

   ```tsx title="components/ui/message.tsx"
   "use client"

   import { use } from "react"
   import { useRender } from "@base-ui/react/use-render"
   import * as stylex from "@stylexjs/stylex"
   import type { StyleXStyles } from "@stylexjs/stylex"
   import { clsx } from "clsx"

   import { MessageContext, bubbleStyles, type BubbleAlign } from "@/components/ui/bubble"
   import { VStack, type SpacingStep } from "@/components/ui/stack"
   import { color, leading, space, text } from "@/theme/tokens.stylex"

   const styles = stylex.create({
     root: {
       display: "grid",
       gridTemplateColumns: "minmax(0, 1fr)",
       gridTemplateRows: "auto",
       columnGap: space.s2,
       rowGap: space.s1_5,
       width: "100%",
       minWidth: 0,
       fontSize: text.sm,
       lineHeight: leading.sm,
     },
     avatar: {
       display: "flex",
       alignItems: "center",
       justifyContent: "center",
       alignSelf: "end",
       gridRowStart: "1",
       minWidth: space.s8,
     },
     content: {
       gridColumnStart: "1",
       gridRowStart: "1",
       width: "100%",
       overflowWrap: "break-word",
     },
     meta: {
       display: "flex",
       alignItems: "center",
       gap: space.s1,
       gridColumnStart: "1",
       maxWidth: "100%",
       minWidth: 0,
       color: color.mutedForeground,
       fontSize: text.xs,
       lineHeight: leading.xs,
       fontWeight: 500,
     },
     header: { gridRowStart: "span 1", gridRowEnd: "1" },
     footer: { gridRowStart: "2" },
   })

   const aligns = stylex.create({
     start: {},
     end: { justifyItems: "end" },
   })

   const avatarSides = stylex.create({
     start: { gridColumnStart: "span 1", gridColumnEnd: "1" },
     end: { gridColumnStart: "2" },
   })

   const messageStyles = {
     base: styles.root,
     aligns,
     avatar: styles.avatar,
     avatarSides,
     content: styles.content,
     header: [styles.meta, bubbleStyles.textInset, styles.header],
     footer: [styles.meta, bubbleStyles.textInset, styles.footer],
   }

   type Overrides = { xstyle?: StyleXStyles; className?: string }

   type MessageGroupProps = useRender.ComponentProps<"div"> & Overrides & { gap?: SpacingStep }

   function MessageGroup({ gap = 1, ...props }: MessageGroupProps) {
     return <VStack data-slot="message-group" gap={gap} {...props} />
   }

   type MessageProps = useRender.ComponentProps<"div"> & Overrides & { align?: BubbleAlign }

   function Message({
     render,
     ref,
     style,
     align = "start",
     xstyle,
     className,
     ...props
   }: MessageProps) {
     const sx = stylex.props(styles.root, aligns[align], xstyle)

     return (
       <MessageContext value={{ align }}>
         {useRender({
           defaultTagName: "div",
           render,
           ref,
           props: {
             "data-slot": "message",
             "data-align": align,
             ...sx,
             ...props,
             className: clsx(sx.className, className),
             style: { ...sx.style, ...style },
           },
         })}
       </MessageContext>
     )
   }

   function MessageAvatar({
     render,
     ref,
     style,
     xstyle,
     className,
     ...props
   }: useRender.ComponentProps<"div"> & Overrides) {
     const align = use(MessageContext)?.align ?? "start"
     const sx = stylex.props(styles.avatar, avatarSides[align], xstyle)

     return useRender({
       defaultTagName: "div",
       render,
       ref,
       props: {
         "data-slot": "message-avatar",
         ...sx,
         ...props,
         className: clsx(sx.className, className),
         style: { ...sx.style, ...style },
       },
     })
   }

   type MessageContentProps = useRender.ComponentProps<"div"> & Overrides & { gap?: SpacingStep }

   function MessageContent({ gap = 1.5, xstyle, ...props }: MessageContentProps) {
     const align = use(MessageContext)?.align
     return (
       <VStack
         data-slot="message-content"
         gap={gap}
         align={align === "end" ? "end" : undefined}
         xstyle={[styles.content, xstyle]}
         {...props}
       />
     )
   }

   function MessageHeader({
     render,
     ref,
     style,
     xstyle,
     className,
     ...props
   }: useRender.ComponentProps<"div"> & Overrides) {
     const sx = stylex.props(styles.meta, bubbleStyles.textInset, styles.header, xstyle)

     return useRender({
       defaultTagName: "div",
       render,
       ref,
       props: {
         "data-slot": "message-header",
         ...sx,
         ...props,
         className: clsx(sx.className, className),
         style: { ...sx.style, ...style },
       },
     })
   }

   function MessageFooter({
     render,
     ref,
     style,
     xstyle,
     className,
     ...props
   }: useRender.ComponentProps<"div"> & Overrides) {
     const sx = stylex.props(styles.meta, bubbleStyles.textInset, styles.footer, xstyle)

     return useRender({
       defaultTagName: "div",
       render,
       ref,
       props: {
         "data-slot": "message-footer",
         ...sx,
         ...props,
         className: clsx(sx.className, className),
         style: { ...sx.style, ...style },
       },
     })
   }

   export {
     Message,
     MessageAvatar,
     MessageContent,
     MessageFooter,
     MessageGroup,
     MessageHeader,
     messageStyles,
   }
   ```

4. Change the `@/` imports if your project uses different aliases.

## Usage

```tsx
import { Avatar, AvatarFallback } from "@/components/ui/avatar"
import { Bubble, BubbleContent } from "@/components/ui/bubble"
import { Message, MessageAvatar, MessageContent } from "@/components/ui/message"
```

```tsx
<Message>
  <MessageAvatar>
    <Avatar>
      <AvatarFallback>AL</AvatarFallback>
    </Avatar>
  </MessageAvatar>
  <MessageContent>
    <Bubble variant="secondary">
      <BubbleContent>I reran the benchmark on both machines.</BubbleContent>
    </Bubble>
  </MessageContent>
</Message>
```

## Composition

```text
Message
├── MessageAvatar
├── MessageHeader
├── MessageContent
│   └── Bubble
└── MessageFooter
```

`MessageGroup` stacks back-to-back messages from one sender:

```text
MessageGroup
├── Message
└── Message
```

The header and the footer are children of the message, not of
`MessageContent`. The message is a grid, and the content is its one fixed
cell: the header takes a row above it, the footer a row below, and the avatar
a column beside it, each only when it is there. Write them in reading order,
as above, so a screen reader meets them in the order they are drawn.

`align` on the message moves the whole turn. The avatar goes to that side,
and the header, the content and the footer line up with it. A
[Bubble](https://www.arene.style/docs/components/bubble) inside takes the message's side, so it needs
no `align` of its own.

## Avatar

Use `MessageAvatar` to put an avatar beside the content. It sits level with
the bottom of the content, so a footer below the last bubble does not push it
down. With `align="end"` it moves to the end.

```tsx
import { Avatar, AvatarFallback } from "@/components/ui/avatar"
import { Bubble, BubbleContent, BubbleGroup } from "@/components/ui/bubble"
import { Message, MessageAvatar, MessageContent } from "@/components/ui/message"
import { VStack } from "@/components/ui/stack"
import { widths } from "@/theme/widths"

export default function MessageAvatarDemo() {
  return (
    <VStack gap={6} xstyle={widths.sm}>
      <Message>
        <MessageAvatar>
          <Avatar>
            <AvatarFallback>AT</AvatarFallback>
          </Avatar>
        </MessageAvatar>
        <MessageContent>
          <Bubble variant="secondary">
            <BubbleContent>The nightly import stopped halfway through.</BubbleContent>
          </Bubble>
        </MessageContent>
      </Message>
      <Message align="end">
        <MessageAvatar>
          <Avatar>
            <AvatarFallback>ME</AvatarFallback>
          </Avatar>
        </MessageAvatar>
        <MessageContent>
          <Bubble>
            <BubbleContent>What does the log say?</BubbleContent>
          </Bubble>
        </MessageContent>
      </Message>
      <Message>
        <MessageAvatar>
          <Avatar>
            <AvatarFallback>AT</AvatarFallback>
          </Avatar>
        </MessageAvatar>
        <MessageContent>
          <BubbleGroup>
            <Bubble variant="secondary">
              <BubbleContent>This is the last entry before it stopped.</BubbleContent>
            </Bubble>
            <Bubble variant="secondary">
              <BubbleContent>
                The import ran out of memory on the largest file. The other files finished, so only
                that one needs to run again.
              </BubbleContent>
            </Bubble>
          </BubbleGroup>
        </MessageContent>
      </Message>
    </VStack>
  )
}
```

## Group

`MessageGroup` stacks back-to-back messages from one sender. Put an
empty `MessageAvatar` on the earlier messages so they line up with the avatar
on the last one. `gap` takes a step on the spacing scale and defaults to `1`.

```tsx
import { Avatar, AvatarFallback } from "@/components/ui/avatar"
import { Bubble, BubbleContent } from "@/components/ui/bubble"
import { Message, MessageAvatar, MessageContent, MessageGroup } from "@/components/ui/message"
import { widths } from "@/theme/widths"

export default function MessageGroupDemo() {
  return (
    <MessageGroup xstyle={widths.sm}>
      <Message>
        <MessageAvatar />
        <MessageContent>
          <Bubble variant="secondary">
            <BubbleContent>I reran the benchmark on both machines.</BubbleContent>
          </Bubble>
        </MessageContent>
      </Message>
      <Message>
        <MessageAvatar>
          <Avatar>
            <AvatarFallback>AL</AvatarFallback>
          </Avatar>
        </MessageAvatar>
        <MessageContent>
          <Bubble variant="secondary">
            <BubbleContent>
              The numbers agree within two percent, so the speedup holds.
            </BubbleContent>
          </Bubble>
        </MessageContent>
      </Message>
    </MessageGroup>
  )
}
```

## Header and footer

`MessageHeader` holds the sender's name, and `MessageFooter` holds details such
as whether the message was delivered or read. Both are indented to line up with the text inside a
bubble, `ghost` included.

```tsx
import { Bubble, BubbleContent } from "@/components/ui/bubble"
import { Message, MessageContent, MessageFooter, MessageHeader } from "@/components/ui/message"
import { Text } from "@/components/ui/text"
import { VStack } from "@/components/ui/stack"
import { widths } from "@/theme/widths"

export default function MessageHeaderFooter() {
  return (
    <VStack gap={8} xstyle={widths.sm}>
      <Message>
        <MessageHeader>Ada</MessageHeader>
        <MessageContent>
          <Bubble variant="secondary">
            <BubbleContent>I already compared the two datasets.</BubbleContent>
          </Bubble>
        </MessageContent>
      </Message>
      <Message align="end">
        <MessageContent>
          <Bubble>
            <BubbleContent>
              Send the summary to the team. Ask Ada if anything looks off.
            </BubbleContent>
          </Bubble>
        </MessageContent>
        <MessageFooter>
          Read <Text weight="normal">Yesterday</Text>
        </MessageFooter>
      </Message>
    </VStack>
  )
}
```

## Actions

Put message actions in `MessageFooter`: copy, retry, or feedback toggles. Use
ghost icon buttons, each with a [Tooltip](https://www.arene.style/docs/components/tooltip) and an
`aria-label`, and set `aria-pressed` on a toggle.

```tsx
"use client"

import { useEffect, useState, type ComponentProps } from "react"
import * as stylex from "@stylexjs/stylex"
import { Bubble, BubbleContent } from "@/components/ui/bubble"
import { Button } from "@/components/ui/button"
import { Message, MessageContent, MessageFooter } from "@/components/ui/message"
import { Text } from "@/components/ui/text"
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"
import { VStack } from "@/components/ui/stack"
import { color } from "@/theme/tokens.stylex"
import { widths } from "@/theme/widths"
import { ArrowClockwiseIcon } from "@phosphor-icons/react/dist/csr/ArrowClockwise"
import { CheckIcon } from "@phosphor-icons/react/dist/csr/Check"
import { CopyIcon } from "@phosphor-icons/react/dist/csr/Copy"
import { ThumbsDownIcon } from "@phosphor-icons/react/dist/csr/ThumbsDown"
import { ThumbsUpIcon } from "@phosphor-icons/react/dist/csr/ThumbsUp"

const styles = stylex.create({
  failed: { color: color.destructive },
})

const reply = "The checksum fails because the cached copy of the archive is stale."

function MessageAction({ label, ...props }: ComponentProps<typeof Button> & { label: string }) {
  return (
    <Tooltip>
      <TooltipTrigger
        render={<Button variant="ghost" size="icon-sm" aria-label={label} {...props} />}
      />
      <TooltipContent>{label}</TooltipContent>
    </Tooltip>
  )
}

export default function MessageActions() {
  const [copied, setCopied] = useState(false)
  const [feedback, setFeedback] = useState<"like" | "dislike" | null>(null)

  useEffect(() => {
    if (!copied) return
    const timeout = setTimeout(() => setCopied(false), 2000)
    return () => clearTimeout(timeout)
  }, [copied])

  return (
    <VStack gap={8} xstyle={widths.sm}>
      <Message>
        <MessageContent>
          <Bubble variant="secondary">
            <BubbleContent>{reply}</BubbleContent>
          </Bubble>
        </MessageContent>
        <MessageFooter>
          <MessageAction
            label={copied ? "Copied" : "Copy"}
            onClick={() => {
              void navigator.clipboard?.writeText(reply)
              setCopied(true)
            }}
          >
            {copied ? <CheckIcon aria-hidden="true" /> : <CopyIcon aria-hidden="true" />}
          </MessageAction>
          <MessageAction
            label="Good response"
            aria-pressed={feedback === "like"}
            onClick={() => setFeedback(feedback === "like" ? null : "like")}
          >
            <ThumbsUpIcon aria-hidden="true" weight={feedback === "like" ? "fill" : "regular"} />
          </MessageAction>
          <MessageAction
            label="Bad response"
            aria-pressed={feedback === "dislike"}
            onClick={() => setFeedback(feedback === "dislike" ? null : "dislike")}
          >
            <ThumbsDownIcon
              aria-hidden="true"
              weight={feedback === "dislike" ? "fill" : "regular"}
            />
          </MessageAction>
        </MessageFooter>
      </Message>
      <Message align="end">
        <MessageContent>
          <Bubble>
            <BubbleContent>I&apos;ll clear the cache and run it again.</BubbleContent>
          </Bubble>
        </MessageContent>
        <MessageFooter>
          <Text weight="normal" xstyle={styles.failed}>
            Failed to send
          </Text>
          <MessageAction label="Retry">
            <ArrowClockwiseIcon aria-hidden="true" />
          </MessageAction>
        </MessageFooter>
      </Message>
    </VStack>
  )
}
```

## Markdown

Put an assistant's reply in a `ghost` bubble, so it is unframed and can take
the full width. It keeps the bubble's padding, so its text lines up with the
header and the footer.

```tsx
import * as stylex from "@stylexjs/stylex"
import { Bubble, BubbleContent } from "@/components/ui/bubble"
import { Message, MessageContent } from "@/components/ui/message"
import { VStack } from "@/components/ui/stack"
import { color, font, leading, radius, space, text } from "@/theme/tokens.stylex"
import { widths } from "@/theme/widths"

const styles = stylex.create({
  list: { paddingInlineStart: space.s5, listStyleType: "decimal" },
  code: {
    paddingInline: space.s1,
    borderRadius: radius.sm,
    backgroundColor: color.muted,
    fontFamily: font.mono,
    fontSize: text.code,
    lineHeight: leading.sm,
  },
})

export default function MessageMarkdown() {
  return (
    <VStack gap={8} xstyle={widths.sm}>
      <Message align="end">
        <MessageContent>
          <Bubble>
            <BubbleContent>Can a reply include formatting?</BubbleContent>
          </Bubble>
        </MessageContent>
      </Message>
      <Message>
        <MessageContent>
          <Bubble variant="ghost">
            <BubbleContent>
              <VStack gap={2}>
                <p>Yes. Three things make it work:</p>
                <ol {...stylex.props(styles.list)}>
                  <li>
                    Pass assistant text through <strong>a Markdown renderer</strong>.
                  </li>
                  <li>Show user messages exactly as they were typed.</li>
                  <li>
                    Put the reply in a <code {...stylex.props(styles.code)}>ghost</code> bubble so
                    it has no frame.
                  </li>
                </ol>
              </VStack>
            </BubbleContent>
          </Bubble>
        </MessageContent>
      </Message>
    </VStack>
  )
}
```

## Attachment

Put an [Attachment](https://www.arene.style/docs/components/attachment) in `MessageContent` beside
the bubble, above it or below it. It takes the message's side like a bubble
does.

```tsx
import { DownloadSimpleIcon } from "@phosphor-icons/react/dist/csr/DownloadSimple"
import { FileTextIcon } from "@phosphor-icons/react/dist/csr/FileText"
import {
  Attachment,
  AttachmentAction,
  AttachmentActions,
  AttachmentContent,
  AttachmentDescription,
  AttachmentMedia,
  AttachmentTitle,
} from "@/components/ui/attachment"
import { Bubble, BubbleContent } from "@/components/ui/bubble"
import { Message, MessageContent } from "@/components/ui/message"
import { VStack } from "@/components/ui/stack"
import { widths } from "@/theme/widths"

export default function MessageAttachment() {
  return (
    <VStack gap={8} xstyle={widths.sm}>
      <Message align="end">
        <MessageContent>
          <Attachment orientation="vertical">
            <AttachmentMedia variant="image">
              <img
                src="https://images.unsplash.com/photo-1497366754035-f200968a6e72?w=900&auto=format&fit=crop&q=80"
                alt="Office corridor with glass walls"
              />
            </AttachmentMedia>
          </Attachment>
          <Bubble>
            <BubbleContent>
              Here is a photo of the new floor. Can you put it on the cover of the move plan?
            </BubbleContent>
          </Bubble>
        </MessageContent>
      </Message>
      <Message>
        <MessageContent>
          <Bubble variant="secondary">
            <BubbleContent>
              Done. The move plan now opens with the photo on its cover page.
            </BubbleContent>
          </Bubble>
          <Attachment>
            <AttachmentMedia>
              <FileTextIcon aria-hidden="true" />
            </AttachmentMedia>
            <AttachmentContent>
              <AttachmentTitle>move-plan.pdf</AttachmentTitle>
              <AttachmentDescription>PDF · 3.4 MB</AttachmentDescription>
            </AttachmentContent>
            <AttachmentActions>
              <AttachmentAction aria-label="Download move-plan.pdf" variant="secondary">
                <DownloadSimpleIcon aria-hidden="true" />
              </AttachmentAction>
            </AttachmentActions>
          </Attachment>
        </MessageContent>
      </Message>
      <Message align="end">
        <MessageContent>
          <Bubble>
            <BubbleContent>Thanks, that works.</BubbleContent>
          </Bubble>
        </MessageContent>
      </Message>
    </VStack>
  )
}
```

## Accessibility

`Message` is a presentational layout. Accessibility comes from what you put
in it.

### Icon-only actions

Most footer actions show only an icon. Each one needs an `aria-label`.

```tsx
<MessageFooter>
  <Button variant="ghost" size="icon-sm" aria-label="Copy">
    <CopyIcon aria-hidden="true" />
  </Button>
</MessageFooter>
```

### Status updates

For a message in progress, use a [Marker](https://www.arene.style/docs/components/marker) with
`role="status"`, so assistive technology announces the update when it
appears.

```tsx
<Marker role="status">
  <MarkerContent>Rerunning the benchmark...</MarkerContent>
</Marker>
```

## API reference

Pass `render` to replace a part's element or compose it with another component.
Every part also takes `xstyle`, `className` and `style`.

### Message

Renders a `div`. It provides its `align` to the bubbles inside it.

| Prop    | Type               | Default   |
| ------- | ------------------ | --------- |
| `align` | `"start" \| "end"` | `"start"` |

### MessageGroup

Renders a `div`: a vertical [Stack](https://www.arene.style/docs/components/stack) whose only layout
prop is `gap`.

| Prop  | Type          | Default |
| ----- | ------------- | ------- |
| `gap` | `SpacingStep` | `1`     |

### MessageAvatar

Renders a `div`, at least 32px wide, at the bottom of the turn. Empty, it
keeps the column so grouped messages line up.

### MessageContent

Renders a `div`: a vertical [Stack](https://www.arene.style/docs/components/stack) whose only layout
prop is `gap`. It holds the bubbles and anything beside them, and lines them up
with the message's side.

| Prop  | Type          | Default |
| ----- | ------------- | ------- |
| `gap` | `SpacingStep` | `1.5`   |

### MessageHeader

Renders a `div` in the row above the content, in small muted type, indented
to line up with the text in a bubble.

### MessageFooter

Renders a `div` in the row below the content, styled like the header.

### messageStyles

The style maps behind the component. Spread them onto any element.

| Key           | What it is                                               |
| ------------- | -------------------------------------------------------- |
| `base`        | The turn's grid, its gaps and its type                   |
| `aligns`      | One entry per `align`                                    |
| `avatar`      | The avatar's box, level with the bottom of the content   |
| `avatarSides` | The avatar's column, one entry per `align`               |
| `content`     | The content's cell, width and word breaking              |
| `header`      | The header's row above the content, type, colour, indent |
| `footer`      | The footer's row below the content, type, colour, indent |

### Data attributes

| Attribute                     | On          | Effect                            |
| ----------------------------- | ----------- | --------------------------------- |
| `data-slot="message"`         | the root    | Targets the message from a parent |
| `data-align`                  | the root    | Reflects `align`                  |
| `data-slot="message-avatar"`  | the avatar  | Targets the avatar from a parent  |
| `data-slot="message-content"` | the content | Targets the content from a parent |
| `data-slot="message-header"`  | the header  | Targets the header from a parent  |
| `data-slot="message-footer"`  | the footer  | Targets the footer from a parent  |
| `data-slot="message-group"`   | the group   | Targets the group from a parent   |
