# Message

A conversation's bubbles: runs from one sender on their side, an author line for anyone else, and time separators between pauses.

Live variants: https://design.arcadia.is/components/message

```tsx
import {
  Bubble, MessageGroup, MessageParts, TimeSeparator, bubblePosition,
} from "@arcadia/ui";
```

```tsx
import { MessageGroup, Bubble, TimeSeparator } from "@arcadia/ui";

<div {...sx("cmp-thread", MessageStyles.thread)}>
  <TimeSeparator day="Yesterday" time="12:04 AM" dateTime="2026-11-21T00:04:00Z" />
  <MessageGroup side="end">
    <Bubble side="end" position="first">Can you keep an eye on the smoke flow tonight?</Bubble>
    <Bubble side="end" position="last">Ping me if it goes red twice.</Bubble>
  </MessageGroup>
  <MessageGroup>
    <Bubble position="first">On it.</Bubble>
    <Bubble position="middle">I will run it every hour and keep a list of anything flaky.</Bubble>
    <Bubble position="last">You will hear from me only if it fails twice in a row.</Bubble>
  </MessageGroup>
  <MessageGroup author={sweeper}>
    <Bubble variant="outline">PR 231 is green. Please verify the e2e smoke before it merges.</Bubble>
  </MessageGroup>
</div>
```

## Accessibility

A `MessageGroup` is a `role="group"`; name it with `aria-label` ("Juniper", "You") when the sender is not otherwise read. Bubble text stays selectable and wraps anywhere, so a long path never overflows its column. A `MessageParts` is a group of its own inside the run only when it has a `label`, so a reader meets a picture and its words as one message where the run holds others. Without one it is a plain wrapper: the message around it (the product's own article, "From @hana") already says whose it is, and no unnamed group stands inside a named one.

The picture `avatar` hangs beside a run is the product's own `Avatar`, hidden from a reader where the author line or the group's name already says who speaks. It takes no focus.

Entry motion is skipped under reduced motion and on a hydrated page (`data-instant`); under reduced motion a flash is a still ring for a shorter run.

The `TimeSeparator` is a `time` element; pass `dateTime` so assistive tech and copy carry the exact moment. It takes no focus.

## API reference

### Bubble

- `side` (`"start" | "end"`, default `"start"`)
- `position` (`"single" | "first" | "middle" | "last"`, default `"single"`): Compute it with `bubblePosition(index, count)`.
- `variant` (`"solid" | "outline" | "flat"`, default `"solid"`)
- `enter` (`BubbleEnter | null`): Plays once on mount. Omit for bubbles that were already there (a reload, a scroll back).
- `flush` (`boolean`): No padding, its content clipped to the bubble's corners: a file card, a list of rows, media.
- `selected` (`boolean`): Its context menu is open: the fill steps up.
- `flash` (`boolean`): A jump just landed on it (a find hit, a link, a reply's source): a ring comes up, holds and fades. Set it for the run of `--duration-flash`, then clear it.
- `rootStyle` (`BubbleStyle`): Typed StyleX override: layout and the `--bubble-*` knobs.

Rest props go to `<div>` props and `render`.

### MessageGroup

- `side` (`"start" | "end"`, default `"start"`)
- `author` (`ReactNode`): Who speaks, on one line above the first bubble: for a party who isn't the conversation's own (another agent). A 16px avatar and a name; it sits on the bubble's text edge, so every bubble of the conversation keeps one edge.
- `authorPicture` (`ReactNode`)
- `meta` (`ReactNode`): A quiet caption under the run, on its side: a receipt, a time.
- `avatar` (`ReactNode`): The sender's picture, for a conversation of several parties: it hangs outside the run, `--space-2` from its edge, so every bubble keeps the composer's text edge, and holds at the top of the view while the run scrolls, never past the run's own top or end. The conversation keeps room for it in its inline padding: `--space-6` for a 16px picture. Pass the product's `Avatar` as it is; `aria-hidden` where the author line or the group's name says who it is.
- `rootStyle` (`MessageGroupStyle`): Typed StyleX override: layout and the `--message-*` knobs.

Rest props go to `<div>` props.

### MessageParts

- `side` (`"start" | "end"`, default `"start"`): For every part.
- `position` (`"single" | "first" | "middle" | "last"`, default `"single"`): Its place in its run, as a bubble's.
- `enter` (`BubbleEnter | null`): One entrance for every part, on mount.
- `label` (`string`): Its name, and with it a group for assistive technology. Without one it is a plain wrapper: the message around it (the product's own article, "From @hana") already says whose it is.
- `flash` (`boolean`, default `false`): A jump just landed on it (a reply's source): each of its parts, a picture as a bubble, takes the held ring, so a message of pictures alone is held as one of words is. Set it for the run of `--duration-flash`, then clear it.
- `rootStyle` (`RootStyle<Pick<BubbleKnobs, "--bubble-enter-delay">>`): Typed StyleX override: layout and `--bubble-enter-delay`.

Rest props go to `<div>` props.

### TimeSeparator

- `day` (`ReactNode`): The day ("Today", "Yesterday", "Monday", "Oct 3").
- `time` (`ReactNode`): The time of day ("12:04 AM").
- `dateTime` (`string`): Machine-readable moment for the `<time>` element (an ISO string).
- `rootStyle` (`RootStyle`): Typed StyleX override: layout.

Rest props go to `<div>` props.
