<!-- Generated by scripts/gen-docs.mts from the JSDoc in registry/. Do not edit; run `pnpm run docs`. -->

# TodoList

An agent's plan, step by step: each step with whether it is to do, under way or done, under one line that counts them, "Plan · 2 of 5". It is open while any step is left, and folds to that line once every step is done; once the person opens or closes it, their choice holds. Each step's status is said in words to a screen reader, not only by its icon. It is built on Collapsible.

## Install

Once per app, with Tailwind CSS v4 and an `@/*` path alias (skip `init` in an existing shadcn app), then the component:

```sh
npx shadcn@latest init --base base --preset nova --yes --no-monorepo
npx shadcn@latest add ourostack/ouro-ui/ouro-base#v1.3.823
npx shadcn@latest add ourostack/ouro-ui/todo-list#v1.3.823
```

More: [Installing](https://ui.ouroboros.bot/docs/installing.md).

```tsx
import { TodoList } from "@/components/ouro/todo-list/todo-list";
```

## Example

```tsx
<TodoList items={[
  { id: "1", title: "Read the recipes", status: "done" },
  { id: "2", title: "Build the grocery list", status: "in_progress" },
  { id: "3", title: "Book the delivery", status: "pending" },
]} />
```

## Usage

Its agent side, `todoListAx` in `todo-list-styles.ts`, lets an agent read the plan. It offers no action: the agent writes its plan through its own runtime.

## Use instead when

- Use `Checklist` instead for a list the person ticks off themselves, and `ToolCallGroup` for the calls an agent made.

## Props

Type: `TodoListProps`.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  | Layout only: margins, width (`mt-2`). Appearance classes warn in development. |
| `defaultOpen` | `boolean` |  | Opens it first and keeps it open after every step is done, until the person closes it. |
| `items` (required) | `readonly TodoItem[]` |  | The agent's steps, in its order. With none, TodoList renders nothing. |
| `label` | `string` | `"Plan"` | The title's first word, before the count: "Plan · 2 of 5". |
| `onOpenChange` | `((open: boolean) => void)` |  | Called with the new state when the person opens or closes it. |
| `open` | `boolean` |  | Whether it is open, when you control it. Pair it with `onOpenChange`. |
| `ref` | `Ref<HTMLDivElement>` |  | Reaches the rendered element. |

## Don't use

These are not props. Passing one fails the type check with the fix in the error, and in development a console message names the fix.

- `tasks`: Not a prop. The steps are `items`: `<TodoList items={[{ id, title, status }]}>`.
- `title`: Not a prop. The title's word is `label`: `<TodoList label="Plan">`.
- `todos`: Not a prop. The steps are `items`: `<TodoList items={[{ id, title, status }]}>`.

## `className` is for layout only

Pass margins, width and grid placement (`mt-4`, `w-full`, `col-span-2`).

Appearance comes from props, not classes. In development, a class that sets appearance logs one warning per component instance, naming the prop to use instead. A class sets appearance when, after its variants (`hover:`, `sm:`) and any `!` are removed, it starts with `bg-`, `text-`, `border-`, `rounded-`, `shadow-`, `font-`, `ring-`, `from-`, `via-`, `to-`, `fill-` or `stroke-`, or is `border`, `rounded`, `shadow` or `ring`, or has a `dark:` variant. Text wrapping, overflow and table layout classes (`text-wrap`, `text-ellipsis`, `border-collapse`) are layout and do not warn.

Alignment classes (`text-center`) warn too: set alignment on a parent element.

## Types

### `TodoItem`

One step of an agent's plan.

```ts
interface TodoItem {
  /** Your app's id for the step. */
  id: string;
  /** What the step is, as the agent wrote it: "Read the recipes". */
  title: string;
  /** Where it stands: `pending` (to do), `in_progress` (doing now) or `done`. */
  status: TodoStatus | (string & { 'Use "pending", "in_progress" or "done"': never });
}
```
