# Cited Answer

An AI answer that streams in with numbered citation pills while each source slides into the list. A passage panel under the answer shows the quoted text behind the source in focus, and pointing at a pill lifts its source and tints the sentences that rely on it.

- Page and source: https://uibrik.com/components/cited-answer
- Install (Pro, needs a license key, see https://uibrik.com/docs/pro): `npx shadcn@latest add @uibrik-pro/cited-answer`
- Packages: none beyond React
- Import: `import { CitedAnswer } from "@/components/uibrik/cited-answer/cited-answer"`

Where to use the Cited Answer React component:

- **AI search and RAG apps**: Every claim links to the passage it came from, so users can check the answer without leaving the page. Pairs with [Streaming Chat](https://uibrik.com/components/streaming-chat) and [Prompt Input](https://uibrik.com/components/prompt-input).
- **Internal knowledge assistants**: PDF, doc and data sources show their kind and relevance, so teams can tell which documents an answer relied on. Pairs with [File Card](https://uibrik.com/components/file-card).
- **Research and support tools**: Highlighting the sentences behind each source makes it easy to see which parts of an answer are well supported. Pairs with [Agent Trace](https://uibrik.com/components/agent-trace).

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| query | `string` | `"How do heat pumps keep working in very cold weather?"` | The question, shown above the answer. |
| color | `string` | `"#5b7bd6"` | Accent for pills, bars and highlights. |
| answer | `string` |  | The answer, with citations written as [1], [2] (1-based into sources). |
| sources | `{ title; site; url?; kind?: "web" \| "pdf" \| "doc" \| "data"; score?: 0–1; passage; quote? }[]` |  | What the answer cites. quote is the part of passage to highlight. |
| activeSource / onActiveSourceChange | `number \| null / (index) => void` |  | Controlled highlighted source. |
| className | `string` |  | Classes for the card. Two columns from 640px wide, stacked below. |
