Context Cards

Retrieved knowledge chunks with their sources.

Installation

pnpm dlx shadcn@latest add @ward/context-cards

Add the Ward registry to components.json once:

"registries": {
  "@ward": "https://ward.so/r/{name}.json"
}

Or install from the URL with no configuration: npx shadcn@latest add https://ward.so/r/context-cards.json

Usage

import ContextCards from "@/components/ward/ContextCards";
<ContextCards
  labels={{ header: "Retrieved chunks", count: "1" }}
  chunks={[
    {
      title: "Returns policy",
      chars: "310 characters",
      body: "Unopened items can be returned within 30 days of delivery.",
      source: "Returns Policy.pdf",
      badge: "PDF",
      tone: "bg-red",
    },
  ]}
/>

Props

PropTypeDefaultDescription
variantstring"Default"Accepted for registry parity; the component has a single variant.
chunksContextChunk[]CHUNKSRetrieved chunks to show, each with a title, character count, body text, source name, badge text and badge colour class.
labelsPartial<ContextCardsLabels>-Overrides for the header text and the count shown beside it.
classNamestring-Extra classes added to the outer wrapper.

Ward · Version 1.1.0 · Registry manifest