# Chat List

> The conversations of a chat workspace: grouped, with unread counts, the agent's state as a dot, the last message and when it came.

Component · AI · Halo kit · [Live page](https://ui.twentyfirst.media/halo/components/ChatList/)

The conversations of a chat workspace: grouped, with unread counts, the agent's state as a dot, the last message and when it came.

Props: `groups` ({title, mark, items}), `selected`, `onSelect`, `query` / `onQueryChange`, `onSearch(q, parsed)`, `filter`, `filters`, `searchPlaceholder`, `linkAs`.

Items: `id`, `name`, `sub` (the last message), `time` or `date` (shown relative), `tint`, `avatar` / `avatarSrc` (people), `status` ("ok", "running", "signal" for waiting on you, "warn", "danger", "idle"), `unread`, `pinned`, `project`, `from`, `href` (rows become links; with `linkAs` your router's).

- Groups in the order people scan: pinned, then the agents of each project, then people.
- Search tokens: `from:Atlas` (the name or `from`), `in:Northwind` (the project or the group), `before:2026-04-15` and `after:…` (the `date`), plus free words. Tokens show as chips under the field; their × removes them.
- `onSearch` hands the parsed tokens to your server (`parseChatQuery` does the same); `filter={false}` leaves the filtering to it.

## Example

```tsx
import * as React from "react";
import { ChatList } from "@twentyfirstmedia/halo";
import type { ChatListProps } from "@twentyfirstmedia/halo";

const groups: ChatListProps["groups"] = [
  {
    title: "Pinned",
    items: [
      {
        id: "mb",
        name: "Main Brain",
        sub: "Morning briefing is ready",
        time: "08:00",
        tint: "lilac",
        status: "ok",
        pinned: true,
      },
    ],
  },
  {
    title: "Northwind",
    mark: "sky",
    items: [
      {
        id: "atlas",
        name: "Atlas",
        sub: "Waiting for your approval",
        time: "09:41",
        tint: "sky",
        status: "signal",
        unread: 2,
        project: "Northwind",
        date: "2026-04-16T09:41:00",
        from: ["Atlas", "Mara Ellis"],
      },
      {
        id: "ads",
        name: "Ads",
        sub: "Budget at 82%",
        time: "Tue",
        tint: "mint",
        status: "warn",
        project: "Northwind",
        date: "2026-04-14T17:00:00",
      },
      {
        id: "scout",
        name: "Scout",
        sub: "Paused · no budget left",
        time: "Mon",
        tint: "butter",
        status: "idle",
        project: "Northwind",
        date: "2026-04-13T08:00:00",
      },
    ],
  },
  {
    title: "Finance",
    mark: "butter",
    items: [
      {
        id: "ledger",
        name: "Ledger",
        sub: "Error: bank feed expired",
        time: "Mon",
        tint: "butter",
        status: "danger",
        project: "Finance",
        date: "2026-04-13T10:00:00",
      },
    ],
  },
  {
    title: "People",
    items: [
      {
        id: "lena",
        name: "Lena Hart",
        sub: "Sounds good",
        time: "Mon",
        avatar: true,
        unread: 1,
        date: "2026-04-13T11:00:00",
      },
    ],
  },
];

export default function Preview() {
  const [selected, setSelected] = React.useState("atlas");
  const [query, setQuery] = React.useState("in:northwind before:2026-04-15");
  return (
    <div className="tf-panel" style={{ maxWidth: 360, height: 520 }}>
      <ChatList
        groups={groups}
        selected={selected}
        onSelect={setSelected}
        query={query}
        onQueryChange={setQuery}
        searchPlaceholder="Search, or from: in: before:"
      />
    </div>
  );
}
```

## Props

### ChatList

| Prop | Type | Notes |
| --- | --- | --- |
| `groups` | `ChatListGroup[]` | Groups as you sort them: pinned, the agents of each project, people. |
| `selected?` | `string` |  |
| `onSelect?` | `(id: string) => void` |  |
| `onSearch?` | `(q: string, parsed: ChatQuery) => void` | Called with the query and its tokens, e.g. to search on your server. |
| `query?` | `string` | Controls the search (tokens `from:`, `in:`, `before:`, `after:` and words). |
| `onQueryChange?` | `(q: string) => void` |  |
| `filter?` | `boolean` | `false`: the list does not filter itself (your server does, from `onSearch`). |
| `filters?` | `ReactNode` |  |
| `searchPlaceholder?` | `string` |  |
| `linkAs?` | `ElementType` |  |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |
