Inbox list
Email threads with sender, company, subject, preview, time, unread mark and a reply label, with the open thread highlighted.
pnpm dlx shadcn@latest add @haze/inbox-list---
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>When to use
- A CRM or outreach tool sorts the replies it received
- A support screen lists conversations next to the open one
When not to use
- Only one conversation is on screen. Use chat-thread.
- Rows hold many columns that need sorting. Use table.
Installation
Add the Haze registry to components.json once, then install Inbox list with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.
pnpm dlx shadcn@latest add @haze/inbox-listnpx shadcn@latest add @haze/inbox-listyarn dlx shadcn@latest add @haze/inbox-listbunx --bun shadcn@latest add @haze/inbox-listFirst time? Registry and theme setup
1. Add to components.json:
{
"registries": {
"@haze": "http://localhost:4329/r/{name}.json"
}
}2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
| label | string | "Replies" | 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 }[] | – | Threads, newest first. |
| unreadLabel | string | "Unread" | Word read before an unread thread. |
| class | string | – | Additional classes on the list. |
Keyboard interactions
- Tab
- Move between threads.
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.
Notes for AI
Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.
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": "http://localhost:4329/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: http://localhost:4329/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.
Dependencies
- @haze/avatar
- @haze/tag
- @haze/utils
- @haze/theme (one-time setup)
Source · Original Haze UI work.