Context Cards
ProNewRetrieved RAG knowledge chunk cards with source badges, relevance meters, type filters, and expandable excerpts.
Installation
pnpm dlx shadcn@latest add @viewport/context-cards
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
The code behind the preview above comes with Truffle Pro.
Props
| Prop | Type | Default |
|---|---|---|
| chunks* | ContextChunk[]Retrieved chunks to display. | — |
| totalChunks | numberTotal indexed chunks shown in the header pill. | — |
| label | stringOptional heading label. | "Retrieved context" |
| className | string | — |
Accessibility
- Filter pills expose aria-pressed; chunk rows are disclosure buttons with aria-expanded.
- Relevance percentages remain readable as text alongside the visual meter.
- Filter reflow and panel expansion respect prefers-reduced-motion.