Research run
Deep-research run card showing query planning steps, source badges and a synthesized report with interactive sentence citations.
pnpm dlx shadcn@latest add @haze/research-run---
import { CheckCircle2, Globe, SearchCheck, Sparkles } from "@lucide/astro";
import { cn } from "../../../lib/haze/utils";
interface Props {
id?: string;
query?: string;
class?: string;
}
const {
id = "haze-research-run",
query = "Compare edge SQLite vs regional Postgres for read-heavy multi-tenant SaaS apps",
class: className,
} = Astro.props;
const steps = [
{ label: "Planned 4 sub-queries", detail: "latency benchmarks, write routing, backup RPO, pricing at 500 GB" },
{ label: "Read 14 sources", detail: "Turso docs, Neon architecture notes, Cloudflare D1 limits, Postgres 17 benchmarks" },
{ label: "Cross-checked contradictions", detail: "Verified global read replica lag vs single-writer consistency bounds" },
];
const sources = [
{ id: 1, title: "SQLite at the Edge", host: "turso.tech" },
{ id: 2, title: "Serverless Postgres Read Replicas", host: "neon.tech" },
{ id: 3, title: "Multi-tenant Isolation Patterns", host: "postgres.org" },
];
---
<section aria-labelledby={`${id}-title`} data-haze-research-run class={cn("bg-background px-4 py-10 sm:px-6 sm:py-14", className)}>
<div class="mx-auto max-w-4xl rounded-2xl border border-border bg-card p-5 sm:p-7">
<div class="flex flex-wrap items-center justify-between gap-2">
<span class="inline-flex items-center gap-1.5 rounded-full border border-frame bg-muted px-2.5 py-0.5 text-xs font-medium text-foreground">
<SearchCheck class="size-3.5" aria-hidden="true" />
Deep research complete
</span>
<span class="font-mono text-xs text-muted-foreground tabular-nums">14 sources · 38s</span>
</div>
<h2 id={`${id}-title`} class="mt-3 text-xl/7 font-semibold tracking-tight text-foreground">{query}</h2>
<ol role="list" class="mt-5 grid gap-2 rounded-xl border border-border bg-muted/40 p-3.5">
{
steps.map((step) => (
<li class="flex items-start gap-2.5 text-xs/5">
<CheckCircle2 class="mt-0.5 size-4 shrink-0 text-success" aria-hidden="true" />
<div>
<span class="font-medium text-foreground">{step.label}</span>
<span class="text-muted-foreground"> — {step.detail}</span>
</div>
</li>
))
}
</ol>
<div class="mt-5 flex flex-wrap gap-2">
{
sources.map((s) => (
<button
type="button"
data-rr-cite={String(s.id)}
class="inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-lg border border-frame bg-field px-2.5 text-xs text-muted-foreground transition-colors duration-150 hover:border-frame-strong hover:text-foreground data-[active=true]:border-border-strong data-[active=true]:bg-accent data-[active=true]:text-foreground focus-visible:outline-2 focus-visible:outline-ring active:scale-[0.97] active:duration-75"
>
<Globe class="size-3.5 text-muted-foreground" aria-hidden="true" />
<span class="font-mono text-[0.6875rem] font-semibold text-foreground">[{s.id}]</span>
<span class="font-medium text-foreground">{s.title}</span>
<span class="hidden sm:inline">· {s.host}</span>
</button>
))
}
</div>
<div class="mt-5 space-y-3 border-t border-border pt-5 text-sm/7 text-foreground">
<h3 class="inline-flex items-center gap-1.5 text-sm/5 font-semibold text-foreground">
<Sparkles class="size-4 text-muted-foreground" aria-hidden="true" />
Executive summary
</h3>
<p>
<span data-rr-sent="1" class="rounded-sm px-0.5 transition-colors duration-150 data-[lit=true]:bg-accent">
Per-tenant embedded SQLite replicas deliver sub-15 ms reads globally when each tenant's working set fits inside a single regional file.
</span>
<button type="button" data-rr-cite="1" aria-label="Cite source 1" class="mx-1 inline-flex size-5 cursor-pointer items-center justify-center rounded-sm border border-frame bg-muted font-mono text-[0.6875rem] font-semibold text-foreground">1</button>
<span data-rr-sent="2" class="rounded-sm px-0.5 transition-colors duration-150 data-[lit=true]:bg-accent">
Regional Postgres with read replicas remains stronger when analytical joins, transactional queues, or strict row-level security span multiple tenants.
</span>
<button type="button" data-rr-cite="2" aria-label="Cite source 2" class="mx-1 inline-flex size-5 cursor-pointer items-center justify-center rounded-sm border border-frame bg-muted font-mono text-[0.6875rem] font-semibold text-foreground">2</button>
</p>
<p>
<span data-rr-sent="3" class="rounded-sm px-0.5 transition-colors duration-150 data-[lit=true]:bg-accent">
A pragmatic default is Postgres as the system of record with edge caching or SQLite read projections for high-frequency lookup tables.
</span>
<button type="button" data-rr-cite="3" aria-label="Cite source 3" class="mx-1 inline-flex size-5 cursor-pointer items-center justify-center rounded-sm border border-frame bg-muted font-mono text-[0.6875rem] font-semibold text-foreground">3</button>
</p>
</div>
<p data-rr-status role="status" class="mt-3 min-h-4 text-xs/4 text-muted-foreground"></p>
</div>
</section>
<script>
function initResearchRuns() {
document.querySelectorAll<HTMLElement>("[data-haze-research-run]").forEach((root) => {
if (root.hasAttribute("data-enhanced")) return;
root.setAttribute("data-enhanced", "");
const status = root.querySelector<HTMLElement>("[data-rr-status]");
const light = (id: string | null) => {
root.querySelectorAll<HTMLElement>("[data-rr-sent]").forEach((el) => el.setAttribute("data-lit", String(el.dataset.rrSent === id)));
root.querySelectorAll<HTMLElement>("[data-rr-cite]").forEach((el) => el.setAttribute("data-active", String(el.dataset.rrCite === id)));
};
root.querySelectorAll<HTMLElement>("[data-rr-cite]").forEach((btn) => {
const id = btn.dataset.rrCite ?? null;
btn.addEventListener("mouseenter", () => light(id));
btn.addEventListener("mouseleave", () => light(null));
btn.addEventListener("click", () => {
light(id);
if (status) status.textContent = `Showing claim supported by source [${id}].`;
});
});
});
}
initResearchRuns();
document.addEventListener("astro:page-load", initResearchRuns);
</script>When to use
- Presenting multi-step web or workspace research alongside the final cited report
- Letting readers inspect which research source backs each claim in the summary
When not to use
- Showing a single short Q&A answer without research steps; use ai-answer
Installation
Add the Haze registry to components.json once, then install Research run with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.
pnpm dlx shadcn@latest add @haze/research-runnpx shadcn@latest add @haze/research-runyarn dlx shadcn@latest add @haze/research-runbunx --bun shadcn@latest add @haze/research-runFirst 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 |
|---|---|---|---|
| id | string | "haze-research-run" | Unique prefix for section heading IDs. |
| query | string | Database architecture research query | Research prompt shown as the main heading. |
| class | string | – | Extra classes on the outer section. |
Keyboard interactions
- Tab
- Move across source chips and inline citation buttons
- EnterSpace
- Highlight the sentence backed by the focused source
Accessibility
- Research steps are presented in an ordered list so screen readers announce sequence and completion.
- Source pills and inline citation buttons highlight their supporting sentence on hover or click and announce the selection.
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 block "Research run" with `npx shadcn@latest add @haze/research-run`. 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 ResearchRun from "@/components/haze/blocks/research-run.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/blocks/research-run.md
Customize with real content
Adapt the Haze research-run block for our product. Replace the demo values of these props with our real content: id, query, class. Keep the layout, the heading level rules and these accessibility details: Research steps are presented in an ordered list so screen readers announce sequence and completion. Source pills and inline citation buttons highlight their supporting sentence on hover or click and announce the selection. Do not add raw color classes; use the Haze tokens.
Choose the right block
Before using research-run, check it fits: use it when presenting multi-step web or workspace research alongside the final cited report; letting readers inspect which research source backs each claim in the summary. Avoid it when showing a single short q&a answer without research steps; use ai-answer. Alternatives: @haze/ai-answer, @haze/timeline.
Dependencies
- npm: @lucide/astro
- @haze/utils
- @haze/theme (one-time setup)
Source · Original Haze UI work.