# Tool Chips

- Page: https://jiguang132.com/resources/beautiful-ui/docs/tool-chips
- Resource: Beautiful UI (https://jiguang132.com/resources/beautiful-ui.md)
- All guides: https://jiguang132.com/resources/beautiful-ui/docs.md

Install: `npx shadcn@latest add https://jiguang132.com/r/beautiful-ui/tool-chips.json`


## When to use

Show compact tool calls and file changes, with expandable details.

## Key props and data

| Native prop | Meaning |
|---|---|
| `steps` | Each step supplies icon, label, chip, mono, detailMono and detail lines. |
| `diffs` | File summaries contain file, add and del counts. |
| `diffLines` | A record keyed by file; each line uses text and add/del/ctx tone. |
| `onOpenChange` | Receives the run header's expanded state. |
| `onToggleRow` | Receives the row label and expanded state. |

## Interaction and state checks

Give rows distinct labels, then test header collapse, row expand and file hover details. File keys in diffs and diffLines must agree.

## Integration boundaries

Rows appear on a local timer, not a tool transport. variant is accepted for gallery parity but does not create alternate visuals.

The runnable usage and source reference below preserve the native API. These practical guides do not claim a full translation of upstream prose.


## Runnable usage

Install a complete example below first, then import its installed entry. Parameterized example source, shared helpers, native components and CSS are included; no manual relative-import edits are required.

```tsx
import Demo from '@/components/beautiful-ui/examples/presets/tool-chips-tool-run';
import '@/styles/beautiful-ui.css';
export default function Example() { return <Demo />; }

```


## Preview states

Default, Tool run

Demo state and mock data do not provide a backend service. Inspect the component props before wiring real data.

Code edits and tool calls as compact chips.



## Complete example installation

These are runnable native states and parameterized usage scenarios, not additional components. Each bundle includes its source closure, helpers, pinned dependencies, independent CSS and licenses. Scenario names are not new native component props; consult the source API below.

### Default

```bash
npx shadcn@latest add https://jiguang132.com/r/beautiful-ui/examples/tool-chips/tool-chips-default.json
```

Default import: `@/components/beautiful-ui/examples/presets/tool-chips-default`

Dependencies: `clsx@2.1.1`, `tailwind-merge@3.6.0`, `shadow-plugin@2.1.1`

### Tool run

```bash
npx shadcn@latest add https://jiguang132.com/r/beautiful-ui/examples/tool-chips/tool-chips-tool-run.json
```

Default import: `@/components/beautiful-ui/examples/presets/tool-chips-tool-run`

Dependencies: `clsx@2.1.1`, `tailwind-merge@3.6.0`, `shadow-plugin@2.1.1`

Initialize Tailwind CSS v4, import beautiful-ui.css once and synchronize theme with the host html dark class. Examples read html lang for Chinese/English and do not supply backend, authentication or recording. Network/clipboard availability still depends on the browser.


## Source-backed parameter reference

Implementation signatures and types are generated from the pinned local source. Optional props, native inherited types, union branches and never exclusions are preserved. A forwardRef implementation's ref is a React reference, not an additional business prop.


```ts
ToolChips({
  steps = ROWS,
  diffs = DIFFS,
  diffLines = DIFF_LINES,
  labels,
  className,
  onOpenChange,
  onToggleRow,
}: {
  /** Accepted for gallery/registry parity; ToolChips has no visual variants. */
  variant?: string;
  steps?: ToolStep[];
  diffs?: ToolDiff[];
  diffLines?: Record<string, ToolDiffLine[]>;
  labels?: Partial<ToolChipsLabels>;
  className?: string;
  onOpenChange?: (open: boolean) => void;
  onToggleRow?: (label: string, open: boolean) => void;
} = {})
```



```ts
export type ToolDetailLine = { text: string; tone?: "add" };

export type ToolStep = {
  icon: string;
  label: string;
  chip: string;
  mono: boolean;
  detailMono: boolean;
  detail: ToolDetailLine[];
};

export type ToolDiff = { file: string; add: number; del: number };

export type ToolDiffLine = { text: string; tone: "add" | "del" | "ctx" };

export type ToolChipsLabels = {
  header: string;
  more: string;
};
```


### Destructuring defaults in source

Only defaults written directly in parameter/props destructuring are listed. Conditional expressions, runtime theme and computed values require source inspection; this is not an exhaustive behavior-default list.


```ts
// ToolChips
steps = ROWS

// ToolChips
diffs = DIFFS

// ToolChips
diffLines = DIFF_LINES
```


### Native and external types

External types remain defined by React or native dependencies, not manually expanded into guessed props. The installed version's TypeScript definitions are authoritative.


```ts
Record<string, ToolDiffLine[]>
Partial<ToolChipsLabels>
```

---

Index of all JGuang resources: https://jiguang132.com/llms.txt
