Task Rows
An agent’s task list with progress.
- Read the brief, Done3s
- Collect product photos, In progress
- Draft the launch email, Not started
- Check links, Not started
- Schedule the send, Not started
'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
pnpm add @brand-studio/ui
npm install @brand-studio/ui
yarn add @brand-studio/ui
Install the peer dependencies
npm install react react-dom
Import the stylesheet once
import '@brand-studio/ui/styles.css';
Wrap your app in a brand theme
import { BrandTheme, TaskRows } from '@brand-studio/ui';
import brand from './brand.json';
<BrandTheme palette={brand.tokens} mode="system">
{/* your app */}
</BrandTheme>
Usage
import { TaskRows } from '@brand-studio/ui';
<TaskRows title="Launch email" tasks={tasks} />
Examples
Failed task
- Download the price list, Done2s
- Match 212 products, Failed3 missing
- Update the shop, Not started
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 | '' |
|---|