Skip to content
h v3.13.3
Search the docs
Find a component, section or page.

Triage queue

Plan, Task and Queue: an email with the plan the model proposes, the task a settled email became, and the list around them.

Priya Nair: “Logo files for the spring launch”

Attached are the final SVGs. Can you check they work on the dark footer before Friday?

Create a task in Clients / Launch

Tomas Berg: “Re: invoice 118”

We paid it on the 20th, the receipt is below.

Comment on Invoice 118 reminder

Two open tasks mention this invoice.

Out of office: “Automatic reply: Kickoff call”

I'm away until Monday.

Installation

pnpm add @heyramzi/ui

Usage

import { TriagePlan, TriageQueue, TriageTask } from "@heyramzi/ui/triage";
<TriageQueue {items} key={(mail) => mail.id} empty="Nothing waiting for you.">
  {#snippet row(mail)}
    <TriagePlan
      sender={mail.from}
      subject={mail.subject}
      plan={mail.plan}
      onApprove={() => approve(mail.id)}
      onPick={() => pick(mail.id)}
      onDismiss={() => dismiss(mail.id)}
    />
  {/snippet}
</TriageQueue>

Keyboard and accessibility

Key Does
Tab Moves through each card's buttons.
Enter In the task field, runs the task you typed.
Esc In the task field, cancels it.
  • The actions are plain buttons, with no shortcuts.
  • A plan card is named by its heading, the sender and subject.
  • Errors are alerts, so they're read out as soon as they show.
  • While the call runs, Approve, Dismiss and Use task report unavailable and ignore presses. Focus stays on the one you pressed.
  • Pick another task puts focus in its field. Cancel and Esc put it back on Pick another task.
  • When a card leaves the queue, focus goes to the card now in its place, or to the empty message.

API reference

TriageQueue

items required readonly T[]
key required (item: T) => string
The key a row is tracked by.
kind "plans" | "tasks"
Default "plans"
`plans` stacks cards that need a decision. `tasks` is one divided list of what was decided.
row required Snippet<[T]>
One row: a `TriagePlan` for `plans`, a `TriageTask` for `tasks`.
empty required string
What the person reads when nothing is waiting.
icon Snippet
The glyph above the empty text.
class string
Prop Type Default
items required readonly T[]
key required

The key a row is tracked by.

(item: T) => string
kind

`plans` stacks cards that need a decision. `tasks` is one divided list of what was decided.

"plans" | "tasks" "plans"
row required

One row: a `TriagePlan` for `plans`, a `TriageTask` for `tasks`.

Snippet<[T]>
empty required

What the person reads when nothing is waiting.

string
icon

The glyph above the empty text.

Snippet
class string

TriagePlan

sender required string
Who sent the email.
subject required string
snippet string
The first lines of the body.
received string | null
When it arrived, as text the host already formatted.
receivedAt string | null
The ISO time behind `received`, for the `time` element.
plan string | null
Default null
What the plan will do, as one sentence. Without it the card only offers to dismiss.
reason string | null
Why the model wasn't sure.
error string | null
A failed attempt, shown on the card.
labels Partial<TriagePlanLabels>
onApprove required () => void | Promise<void>
Run the plan. The buttons stay unavailable until it settles.
onPick required (task: string) => void | Promise<void>
Run a task the person typed instead of the plan.
onDismiss required () => void | Promise<void>
class string
Prop Type Default
sender required

Who sent the email.

string
subject required string
snippet

The first lines of the body.

string
received

When it arrived, as text the host already formatted.

string | null
receivedAt

The ISO time behind `received`, for the `time` element.

string | null
plan

What the plan will do, as one sentence. Without it the card only offers to dismiss.

string | null null
reason

Why the model wasn't sure.

string | null
error

A failed attempt, shown on the card.

string | null
labels Partial<TriagePlanLabels>
onApprove required

Run the plan. The buttons stay unavailable until it settles.

() => void | Promise<void>
onPick required

Run a task the person typed instead of the plan.

(task: string) => void | Promise<void>
onDismiss required () => void | Promise<void>
class string

TriageTask

sender required string
subject required string
outcome required TriageOutcome
What happened to the email.
task TriageTaskLink | null
The task it became.
when required string
When it settled, as text the host already formatted.
whenAt string | null
detail string | null
Why it failed.
error string | null
labels Partial<TriageTaskLabels>
onUndo () => void | Promise<void>
Takes the change back. The button shows only when this is passed.
class string
Prop Type Default
sender required string
subject required string
outcome required

What happened to the email.

TriageOutcome
task

The task it became.

TriageTaskLink | null
when required

When it settled, as text the host already formatted.

string
whenAt string | null
detail

Why it failed.

string | null
error string | null
labels Partial<TriageTaskLabels>
onUndo

Takes the change back. The button shows only when this is passed.

() => void | Promise<void>
class string