# Inbox list

> Email threads with sender, company, subject, preview, time, unread mark and a reply label, with the open thread highlighted.

- Kind: ui · Category: Navigation · Interactivity: none
- Install: `npx shadcn@latest add @haze/inbox-list`
- File: `src/components/haze/ui/inbox-list.astro`
- npm dependencies: none
- Registry dependencies: @haze/avatar, @haze/tag, @haze/utils
- Docs page: https://hazeui.com/ui/inbox-list

## Use when
- A CRM or outreach tool sorts the replies it received
- A support screen lists conversations next to the open one

## Avoid when
- Only one conversation is on screen. Use chat-thread.
- Rows hold many columns that need sorting. Use table.

## Alternatives
- [chat-thread](https://hazeui.com/ui/chat-thread.md)
- [item](https://hazeui.com/ui/item.md)
- [table](https://hazeui.com/ui/table.md)

## Props

| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| label | `string` | "Replies" | no | Accessible name of the list. |
| threads | `{ from: string; org?: string; subject: string; preview?: string; time: string; unread?: boolean; label?: { text: string; variant?: Tone }; href: string; current?: boolean }[]` |  | no | Threads, newest first. |
| unreadLabel | `string` | "Unread" | no | Word read before an unread thread. |
| class | `string` |  | no | Additional classes on the list. |

## Accessibility
- Unread threads are read as unread and also shown in bold, not by the dot alone.
- The open thread carries aria-current, and the whole row is one link.
- Key Tab: Move between threads.

## Agent prompts

### Install and use

Install the Haze UI component "Inbox list" with `npx shadcn@latest add @haze/inbox-list`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "https://hazeui.com/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import InboxList from "@/components/haze/ui/inbox-list.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: https://hazeui.com/ui/inbox-list.md

### Customize with real content

Adapt the Haze inbox-list ui for our product. Replace the demo values of these props with our real content: label, threads, unreadLabel, class. Keep the layout, the heading level rules and these accessibility details: Unread threads are read as unread and also shown in bold, not by the dot alone. The open thread carries aria-current, and the whole row is one link. Do not add raw color classes; use the Haze tokens.

### Choose the right block

Before using inbox-list, check it fits: use it when a crm or outreach tool sorts the replies it received; a support screen lists conversations next to the open one. Avoid it when only one conversation is on screen. use chat-thread.; rows hold many columns that need sorting. use table.. Alternatives: @haze/chat-thread, @haze/item, @haze/table.

## Example requests that should lead here
- Add an inbox of sales replies labelled Interested, Later and Not interested, with unread ones bold.

## Source

```astro
---
import { cn } from "../../../lib/haze/utils";
import Avatar from "./avatar.astro";
import Tag from "./tag.astro";

type Tone = "default" | "info" | "success" | "warning" | "destructive";

interface Thread {
  from: string;
  /** Company or address shown after the sender. */
  org?: string;
  subject: string;
  /** First words of the latest message. */
  preview?: string;
  /** Time as it should read, such as "09:12" or "Mon". */
  time: string;
  unread?: boolean;
  /** Sorting label, such as a reply category. Its text carries the meaning. */
  label?: { text: string; variant?: Tone };
  href: string;
  /** The thread open next to the list. */
  current?: boolean;
}

interface Props {
  /** Accessible name of the list. */
  label?: string;
  threads?: Thread[];
  /** Word read for an unread thread, for translation. */
  unreadLabel?: string;
  class?: string;
}

const {
  label = "Replies",
  threads = [
    {
      from: "Amra Kovač",
      org: "Smile Dental",
      subject: "Re: Fewer missed appointments",
      preview: "Sounds interesting. Could you show me how the reminders look on a phone?",
      time: "09:12",
      unread: true,
      label: { text: "Interested", variant: "success" },
      href: "#t1",
      current: true,
    },
    {
      from: "Dario Petrović",
      org: "Petrović Auto",
      subject: "Re: Booking for the service bay",
      preview: "We are fully booked until January, write to me again after the holidays.",
      time: "08:47",
      unread: true,
      label: { text: "Later", variant: "warning" },
      href: "#t2",
    },
    {
      from: "Office",
      org: "Nova Clinic",
      subject: "Automatic reply: out of office",
      preview: "Thank you for your message. We are back on Monday, 1 December.",
      time: "Mon",
      label: { text: "Out of office" },
      href: "#t3",
    },
    {
      from: "Selma Hadžić",
      org: "Studio Forma",
      subject: "Re: Intro",
      preview: "Thanks, but we already use another system. Please remove us from your list.",
      time: "Sun",
      label: { text: "Not interested", variant: "destructive" },
      href: "#t4",
    },
  ],
  unreadLabel = "Unread",
  class: className,
} = Astro.props;
---

<nav aria-label={label} class={cn("overflow-hidden rounded-xl border border-border bg-card", className)}>
  <ul role="list" class="divide-y divide-border">
    {
      threads.map((t) => (
        <li>
          <a
            href={t.href}
            aria-current={t.current ? "true" : undefined}
            class="flex gap-3 px-4 py-3 transition-colors duration-150 ease-snappy hover:bg-accent focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring aria-[current=true]:bg-accent"
          >
            <Avatar name={t.from} size="sm" class="mt-0.5 shrink-0" />
            <span class="min-w-0 flex-1">
              <span class="flex items-baseline gap-2">
                {t.unread && (
                  <span class="size-2 shrink-0 self-center rounded-full bg-foreground forced-colors:bg-[CanvasText]">
                    <span class="sr-only">{unreadLabel}:</span>
                  </span>
                )}
                <span class={cn("min-w-0 truncate text-[0.8125rem]/5", t.unread ? "font-medium text-foreground" : "font-medium text-foreground")}>
                  {t.from}
                  {t.org && <span class="font-normal text-muted-foreground"> · {t.org}</span>}
                </span>
                <span class="ml-auto shrink-0 text-xs/4 text-muted-foreground tabular-nums">{t.time}</span>
              </span>
              <span class={cn("mt-0.5 block truncate text-[0.8125rem]/5", t.unread ? "text-foreground" : "text-muted-foreground")}>{t.subject}</span>
              {t.preview && <span class="mt-0.5 line-clamp-1 text-[0.8125rem]/5 text-muted-foreground">{t.preview}</span>}
              {t.label && (
                <Tag size="sm" variant={t.label.variant ?? "default"} class="mt-2">
                  {t.label.text}
                </Tag>
              )}
            </span>
          </a>
        </li>
      ))
    }
  </ul>
</nav>
```
