# AI State Loading

Agent progress as a list of steps with a live log, elapsed time and a summary when done.

## Installation

AI State Loading is a free, open-source React component in the Kokonut UI AI collection. Add it with the shadcn CLI, which copies the source into `components/kokonutui/ai-loading.tsx`, so the code is yours to change.

```bash
npx shadcn@latest add @kokonutui/ai-loading
```

Or add it by hand: install its packages, then copy the source from above into `components/kokonutui/ai-loading.tsx`.

```bash
npm install lucide-react motion
```

## Usage

```javascript
import AILoadingState from "@/components/kokonutui/ai-loading";

export default function Example() {
  return <AILoadingState />;
}
```

## Props

### `steps`
`AgentStep[]`

The agent's steps, in order. Update them as work progresses. When omitted, a demo run plays on a loop.

### `collapseWhenDone`
`boolean`
Default `true`

Collapse the list once every step is done. Defaults to true.

### `className`
`string`

Extra classes for the root element.

### AgentStep

- `id` required: `string`
- `label` required: `string`
- `status` required: `AgentStepStatus`
- `detail`: `string[]`

Log lines for the step. The running step shows the latest ones.

### AgentStepStatus

```typescript
type AgentStepStatus = "pending" | "running" | "done" | "error";
```

## Dependencies

| Needs | Version | Comes from |
| --- | --- | --- |
| `lucide-react` | `^0.556.0` | npm, installed by the CLI |
| `motion` | `^12.23.25` | npm, installed by the CLI |
| `cn` from `lib/utils.ts` |  | shadcn init |
| React | `19` | Your app |
| Tailwind CSS | `4` | Your app |

No provider, font or global CSS to set up: the file works as soon as it lands.
