Xzero UI
Pro library

Research runPro

Deep research that plans searches, reads sources with their marks, and streams a cited answer where every chip lights up the sentence it supports.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui-pro/research-run
Live · keyboard ready

Use this to show an AI research or search answer. Replace the scripted run in research-run-data.ts with events from your search and model pipeline.

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui-pro/research-run

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { ResearchRun, type ResearchEvent } from "@/components/xzero/blocks/research-run/research-run";

export function Research() {
  return (
    <ResearchRun
      autoStart={false}
      onAsk={async function* (question, history, signal) {
        const res = await fetch("/api/research", { method: "POST", body: JSON.stringify({ question, history }), signal });
        // Your server streams newline delimited ResearchEvent JSON.
        for await (const event of readJsonLines<ResearchEvent>(res.body!)) yield event;
      }}
    />
  );
}

API reference

ResearchRun

A deep research surface. The question is planned into sub-queries that search in parallel, sources gather in a rail with their real marks and a ring that fills while each one is read, and the steps fold into one line such as Researched for 7s, 12 sources. The answer then streams in word by word with citation chips: hovering a chip lights the sentence it supports and its source, clicking one brings the source into view. Follow ups append a new turn; any run can be stopped, rerun and copied with its sources.

PropTypeDefaultDescription
questionstringsample questionThe first question. It runs on mount when autoStart is on.
autoStartbooleantrueStarts the first question on mount. Off opens on an empty state with suggestions.
onAsk(question: string, history: ResearchTurn[], signal: AbortSignal) => AsyncIterable<ResearchEvent>scriptedResearchRuns one turn and yields plan, search, searched, source, read, text, followUps and done events as they happen. Stop aborts signal. [n] in text cites the nth source event of the turn.
suggestionsstring[]three questionsQuestions offered in the empty state.
pacenumber70Reveal pace in characters per second before the arrival rate is known; after that the reveal follows the stream.
onComplete(turn: ResearchTurn) => void–Called when a turn finishes, with its question and answer markdown.
titlestring–Header title. Defaults to the first question, shown once it scrolls under the header.
classNamestring–Class on the root element.

ResearchSource

A source event's payload: id, title, domain, url, and optional logo (URL of a monochrome mark drawn in the text color; the domain's first letter stands in without one), snippet and date.

No props.

Keyboard interactions

KeysAction
EnterSends the question in the composer; Shift + Enter adds a line.
EscapeStops the running research from the composer.
TabMoves through the steps toggle, citation chips, actions, follow ups and source rows. A focused chip lights its sentence and source like hover.
Enter / SpaceOn a chip, brings its source into view and flashes it; on a source row, opens its summary and link.
Arrow Up / Page Up / HomeInside the thread, releases the pin to the newest line, like scrolling up.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Guidance for AI tools

Blocks are complete, self-contained screens with sample data. Replace the sample data and connect the callbacks described above. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components