---
title: "Recipe: a chat header with an avatar, and day pills"
description: "Android's bar and the Mac's title show no avatar, so a chat's header is its own row."
modificationDate: "2026-11-22"
---

> ## Documentation index
> Fetch the complete documentation index at: https://exact.expo.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Recipe: a chat header with an avatar, and day pills

<AgentInstructions>

## Submitting feedback

From the app's directory, read `bun exact.mjs feedback status`. Under `never`, keep no note.
Respect `EXACT_FEEDBACK=0` and do not change the policy.

Otherwise record specific, actionable feedback with:
`bun exact.mjs feedback note "Exact docs: https://exact.expo.dev/recipes/chat-header: <what was wrong or missing>"`

The note goes to Expo only as that status allows. Include no secrets or personal data.

</AgentInstructions>

Android's bar and the Mac's title show no avatar, so a chat's header is its own row.

```prompt Add a chat header with an avatar and day pills
Give a chat screen in the Exact app in this folder its own header row with an avatar, and a pill that opens each day in its transcript. Use https://github.com/expo/exact/blob/main/docs/recipes/chat-header.md as the source for each step. The Exact checkout has the same page at docs/recipes/chat-header.md.

1. If this folder is not an Exact app (it has no exact.mjs and app.contract), stop and tell me.
2. If I did not say which screen is the chat, what its header shows (the name, a status line, a button) and whether the avatar is a symbol or a photo, propose it from the app and ask me before you write code.
3. In app.contract, give the chat route's element `navigationBar="none"` and `navigationScroll` with the transcript's `id`. Draw the header as the route's first row: the avatar, a column with the name as `role="heading" aria-level=1`, and each button with an `aria-label`. No bar draws Back, so a pushed route needs a `button press=back` first in the row.
4. Draw the avatar as a symbol with `aria-hidden="true"`, or as a photo: `image "assets/<file>"` with a fixed `width` and `height`, and a `border-radius` of half of that.
5. In app.ts, give each message its time (`at`) and a `newDay` flag that is true for the first message of a day. In app.contract, read `exactTime()` as a resource and draw the pill with `formatDay(m.at, time.epochAtZero, time.utcOffset, "section")`. Write the pill as the first child of the message's row root, never as a sibling of the row.
6. Add a time on a bubble's last line only if I asked for it; then follow the recipe's hidden run, and its `direction="rtl"` form.
7. Add a test in app.test.contract like the recipe's: after `clock data`, expect the header's name and the text of two day pills (`"Yesterday"`, `"Today"`). The test's date is 2026-01-01 UTC unless `epoch` and `time-zone` pin it.
8. Follow the platform checks in docs/start-here.md (`bun exact.mjs docs platform checks`) for the targets in the app's AGENTS.md and app.json until they pass. Read the reports, including counted findings; a zero exit code alone does not mean clean. Fix the app, not the test. If a finding stays after three rounds of fixes, or the app had it before you changed anything, record it (step 9) and report it; do not keep trying.
9. When a doc was wrong or missing, or a step needed a workaround, read `bun exact.mjs feedback status`. Under `never`, keep no note. Otherwise record it: `bun exact.mjs feedback note "<what happened>"`, which goes to Expo only as that status says. Do not change the policy; tell me how many notes you kept.
10. Tell me what the header shows, where the day pills come from, what the tests and checks reported, and the launch command for each target platform. A pill does not pass midnight by itself: docs/recipes/dates-and-days.md shows how to tick `now`.
```

```contract
routes nav
  home "/"

shape Message
  id: string
  body: string
  at: number
  newDay: bool

shape Time
  epochAtZero: number
  utcOffset: number

component Chat
  resource thread = loadThread() as shape Message[] else empty()
  resource time = exactTime() as shape Time
  view
    main navigationKey=`${top(nav).id}` width="100%" height="100%"
      for e in stack(nav) key=e.id
        column navigationKey=`${e.id}` navigationBar="none" navigationScroll="transcript" position="absolute" inset=0
          row align-items="center" gap=10 padding="8px 12px" border-bottom="1px solid -exact-separator"
            image "symbol:person" aria-hidden="true" font="-exact-title1"
            column flex=1 min-width=0
              text "Ada" role="heading" aria-level=1 font="-exact-headline" testId="name"
              text "online" font="-exact-footnote" color="-exact-secondary-label"
            button aria-label="Call"
              image "symbol:phone"
          list id="transcript" appearance="none" virtualized=true scroll-start="end" flex=1 min-height=0
            for m in thread key=m.id
              column padding="3px 12px"
                if m.newDay
                  text formatDay(m.at, time.epochAtZero, time.utcOffset, "section") align-self="center"
                    padding="2px 10px" border-radius=10 background-color="-exact-fill" font="-exact-caption1"
                    testId=`day-${m.id}`
                text m.body white-space="pre-wrap" testId=`message-${m.id}`
```

```ts
import type { Answer, Result, Sources } from './app.contract.d.ts';

export const grants = '';

const day = 86400000, start = Date.UTC(2026, 0, 1);
const messages: Result<'loadThread'> = [
  { id: '1', body: 'See you', at: start - day, newDay: true },
  { id: '2', body: 'At noon', at: start, newDay: true },
];
const sources: Sources = { loadThread: () => messages };
export const answer: Answer = (source, args, store, storage, native) => sources[source](args, store, storage, native);
```

```contract-test
test "the header names the chat; each day opens with its pill"
  clock data
  expect text "name" == "Ada"
  expect text "day-1" == "Yesterday"
  expect text "day-2" == "Today"
```

- `navigationBar="none"` on the route's element draws no bar: the row is the header, and
  a pushed route needs a `button press=back` first.
- A photo: `image "assets/ada.jpg"`, fixed `width` and `height`, `border-radius` half of it.
- The pill is the row root's first child, not its sibling ([long lists](https://exact.expo.dev/recipes/long-lists.md)).
  Tick `now` as the [dates recipe](https://exact.expo.dev/recipes/dates-and-days.md) does to pass midnight.
- A time on a bubble's last line: in a `box position="relative"`, end the text with a
  hidden run, `` text `  ${m.time}` opacity=0 aria-hidden="true" ``, and draw the time
  `position="absolute" right=8 bottom=4`; in a `direction="rtl"` box `left=8`, the run
  led by U+200F. A full last line pushes it down.
