# Task Rows

> An agent’s task list with progress.

```tsx
'use client';

import { useEffect, useState } from 'react';
import { TaskRows } from '@brand-studio/ui';
import type { TaskRow } from '@brand-studio/ui';

const labels = ['Read the brief', 'Collect product photos', 'Draft the launch email', 'Check links', 'Schedule the send'];

export default function TaskRowsDemo() {
  const [step, setStep] = useState(1);
  useEffect(() => {
    const timer = setInterval(() => setStep((current) => (current + 1) % (labels.length + 2)), 1400);
    return () => clearInterval(timer);
  }, []);
  const tasks: TaskRow[] = labels.map((label, index) => ({
    id: label,
    label,
    status: index < step ? 'done' : index === step ? 'active' : 'pending',
    meta: index < step ? `${index * 4 + 3}s` : undefined,
  }));
  return <div style={{ width: '100%', maxWidth: 440 }}><TaskRows title="Launch email" tasks={tasks} /></div>;
}
```

## Installation

```sh
npm install @brand-studio/ui
```

React 18 or 19 is a peer dependency. Import the stylesheet once and wrap the app in a brand theme:

```tsx
import '@brand-studio/ui/styles.css';
import { BrandTheme, TaskRows } from '@brand-studio/ui';
import brand from './brand.json';

<BrandTheme palette={brand.tokens} mode="system">
  {/* your app */}
</BrandTheme>
```

## Usage

```tsx
import { TaskRows } from '@brand-studio/ui';
```

```tsx
<TaskRows title="Launch email" tasks={tasks} />
```

## Examples

### Failed task

```tsx
import { TaskRows } from '@brand-studio/ui';

export default function TaskRowsFailed() {
  return (
    <div style={{ width: '100%', maxWidth: 440 }}>
      <TaskRows
        title="Import"
        tasks={[
          { id: 'a', label: 'Download the price list', status: 'done', meta: '2s' },
          { id: 'b', label: 'Match 212 products', status: 'failed', meta: '3 missing' },
          { id: 'c', label: 'Update the shop', status: 'pending' },
        ]}
      />
    </div>
  );
}
```

## Accessibility

- The count reads “2 of 5” and each row spells out its status for screen readers.
- Spinners stop under reduced motion; the status text stays.

## API Reference

| Prop | Type | Default |
|---|---|---|
| `tasks` | `TaskRow[]` | – |
| `title?` | `string` | `'Tasks'` |
| `className?` | `string` | `''` |

Source: https://brandstudio.js.org/docs/components/task-rows/
