Tool Chips

Code edits and tool calls as compact chips.

Installation

pnpm dlx shadcn@latest add @ward/tool-chips

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/tool-chips.json

Usage

import ToolChips from "@/components/ward/ToolChips";
<ToolChips
  steps={[
    { icon: "read", label: "Read file", chip: "routes.ts", mono: true, detailMono: true, detail: [{ text: "export const routes = []" }] },
    { icon: "write", label: "Write 12 lines", chip: "routes.ts", mono: true, detailMono: true, detail: [{ text: "+ settingsRoute", tone: "add" }] },
  ]}
  diffs={[{ file: "routes.ts", add: 12, del: 3 }]}
  labels={{ header: "2 tool calls" }}
/>

Props

PropTypeDefaultDescription
variantstring"Default"Accepted for registry parity; ToolChips has no visual variants.
stepsToolStep[]ROWSTool-call rows revealed in turn, each with an icon key (think, write, run or read), a label, a chip and expandable detail lines.
diffsToolDiff[]DIFFSFile-diff chips shown after the rows, each with a file name and its added and removed line counts.
diffLinesRecord<string, ToolDiffLine[]>DIFF_LINESDiff lines keyed by file name, shown in a preview when a diff chip is hovered or focused.
labelsPartial<ToolChipsLabels>-Overrides for the run header text and the trailing 'more' link after the diff chips.
classNamestring-Extra classes added to the root element.
onOpenChange(open: boolean) => void-Called with the new state when the run header is opened or closed.
onToggleRow(label: string, open: boolean) => void-Called with a row's label and new state when it is expanded or collapsed.

Ward · Version 1.1.0 · Registry manifest