Skip to content
caliper ui pro docs

Sourced answer

An answer that shows where it came from: what was searched, the sources it read as numbered cards, and the answer with numbered markers. Point at a marker and its source lights up; choose a source and every claim that leans on it is marked.

Pro

Which exchange rate do you use when a euro invoice is paid in pounds?

Searching for “exchange rate used for cross-currency invoice matching”

Searching for exchange rate used for cross-currency invoice matching

When to use

  • Assistants and search that answer from documents or the web.
  • Support answers drawn from a help centre, where people should check the source.

When not to use

  • Answers with no sources; a plain message is honest about that.
  • A list of search results people browse themselves; use search results.

Installation

terminal
pnpm dlx shadcn@latest add @caliper/sourced-answer

Adds its 3 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.

API reference

SourcedAnswer

8 props
PropTypeDefaultDescription
query *string—
status *SourcedAnswerStatus—
sources *readonly AnswerSource[]—In the order the markers number them: [1] is the first.
answer *string—Plain text with markers such as [1] or [2, 3]; blank lines start paragraphs.
shownnumber—Characters of the answer written so far, while it streams; all of it when absent.
onOpenSource((source: AnswerSource) => void)—
actionsReactNode—Shown under a finished answer: copy, retry, rate.
classNamestring—

Keyboard

  • No custom key handling; Tab and the native activation keys do the work.

Accessibility

It exposes status semantics, with aria-busy, aria-hidden, aria-label, aria-pressed, aria-describedby and aria-live kept in step with state. Changes that matter are announced through a live region.

Notes for AI

Give your coding assistant this page as Markdown instead of screenshots: the props, keyboard and examples in one file.

/docs/components/sourced-answer.md

The index of every part is at /llms.txt.

More in Knowledge