# Task List

A collapsible plan card showing current step progress above the composer and the full ordered step list when expanded.

> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).

<ComponentPreview name="task-list">
  <TaskListDemo />
</ComponentPreview>

## Installation [#installation]

```bash
npx shadcn@latest add https://motif.sweetretry.com/r/task-list.json
```

## Usage [#usage]

```tsx
import {
  TaskList,
  TaskListContent,
  TaskListHeader,
  TaskListItem,
  TaskListItemMarker,
  TaskListItemText,
  TaskListProgress,
  TaskListStatus,
  TaskListTitle,
} from "@/components/ui/motif/task-list";

export function Plan({ tasks }) {
  const done = tasks.filter((task) => task.status === "done").length;
  const active = tasks.find((task) => task.status === "active");

  return (
    <TaskList>
      <TaskListHeader>
        <TaskListStatus status={active ? "active" : "done"} />
        <TaskListTitle>{active?.text ?? "All done"}</TaskListTitle>
        <TaskListProgress done={done} total={tasks.length} />
      </TaskListHeader>
      <TaskListContent>
        {tasks.map((task) => (
          <TaskListItem key={task.id} status={task.status}>
            <TaskListItemMarker />
            <TaskListItemText>{task.text}</TaskListItemText>
          </TaskListItem>
        ))}
      </TaskListContent>
    </TaskList>
  );
}
```

| Part                 | Draws                                                           |
| -------------------- | --------------------------------------------------------------- |
| `TaskList`           | The card; nothing while it has no children                      |
| `TaskListHeader`     | The one line that shows when the list is folded, and its toggle |
| `TaskListProgress`   | `2 / 5`                                                         |
| `TaskListStatus`     | The header's mark, the same three as a step's                   |
| `TaskListTitle`      | The step the agent is on, on one line                           |
| `TaskListContent`    | Every step, as an ordered list, behind the header               |
| `TaskListItem`       | One step, with its status                                       |
| `TaskListItemMarker` | A ring to do, the loading mark in progress, a check done        |
| `TaskListItemText`   | What the step is                                                |

## Behavior & Accessibility [#behavior--accessibility]

- Collapsed by default (`defaultOpen`, `open`, `onOpenChange`); `TaskListHeader` only renders as a toggle button when `TaskListContent` is present.
- Step statuses are `todo`, `active` (carries `aria-current="step"`), and `done`; pass `running={false}` to `TaskList` (default `true`) to show a still dot when paused.
- Pass `label` to `TaskListItemMarker` to translate default screen-reader status labels (`To do`, `In progress`, `Done`).
- Expanded lists cap at `18rem`, scroll internally, and auto-center the active step; `TaskListTitle` is a polite live region and renders nothing when empty.
- Designed to stack above the composer alongside [Queue](/docs/agents/queue).

## Component source [#component-source]

<ComponentSource
  name="task-list"
  src="registry/new-york/agents/task-list.tsx"
  title="task-list.tsx"
/>
