# Package info

A package an agent added, upgraded or removed: the version change with what kind of change it is, the dependencies it touched, and the install state.

Example: Package info. An agent upgrades zod across a major version, and patches date-fns. Preview: https://chatcn.dev/preview/package-info-demo

## Installation

```bash
npx shadcn@latest add https://chatcn.dev/r/package-info.json
```

## Usage

```tsx
import { PackageInfo } from "@/components/ui/chatcn/package-info"

<PackageInfo
  name="zod"
  previousVersion="3.24.2"
  version="4.1.5"
  dependencies={[{ name: "@zod/core", version: "0.11.6", change: "added" }]}
  command="pnpm add zod@4.1.5"
/>
```

The kind of change is read from the two versions (or passed as `change`) and said in words: a major bump says it may break, which is what a reviewer needs to notice. Dependencies the install added, removed or updated sit behind a count, each with a plus, minus or tilde. `state` covers installing and failed, where the error says how to fix it and Retry is in place. Replaces AI Elements' PackageInfo.

## Examples

### States

Example: States. Installing, added, a minor bump with dependency changes, removed, and a failed install with the fix. Preview: https://chatcn.dev/preview/package-info-states

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `name` | `string` |  |
| `version`, `previousVersion` | `string` | From and to. One of them for added or removed |
| `change` | `"major" | "minor" | "patch" | "added" | "removed"` | Read from the versions when left out |
| `description` | `ReactNode` |  |
| `dependencies` | `PackageDependency[]` | `{ name, version?, from?, change: "added" | "removed" | "updated" }` |
| `license`, `size`, `href`, `command` |  | Size in bytes, gzip |
| `state`, `error`, `onRetry` | `"installing" | "installed" | "failed"` |  |
| `labels` | `Partial<PackageInfoLabels>` | Every string, for translation |

## Accessibility

- The change kind is text, with color only as a second signal.
- Dependency changes carry their kind for screen readers, not just the glyph.
- The registry link names the package it opens.

Source: https://chatcn.dev/docs/components/package-info