# Task List

> To-dos with a due date, assignee, priority and the record they belong to, grouped into overdue, today, upcoming, without a date and done.

Component · CRM · Pro kit · [Live page](https://ui.twentyfirst.media/pro/components/TaskList/)

To-dos with a due date, assignee, priority and the record they belong to, grouped into overdue,
today, upcoming, without a date and done.

- `onToggle(id, done)` completes a task; `onOpen(id)` makes its title a button.
- `grouped={false}` gives one flat list, for a record's side panel.

## Example

```tsx
import * as React from "react";
import { Panel, TaskList } from "@twentyfirstmedia/pro";
import type { CrmTask } from "@twentyfirstmedia/pro";

export default function Preview() {
  const [tasks, setTasks] = React.useState<CrmTask[]>([
    {
      id: "1",
      title: "Send revised proposal",
      due: new Date(2026, 10, 14),
      priority: "high",
      assignee: "Mara Ellis",
      related: "Deal · Retainer 2027",
    },
    {
      id: "2",
      title: "Call Lena about the contract",
      due: new Date(2026, 10, 16),
      assignee: "Mara Ellis",
      related: "Person · Lena Hartmann",
    },
    {
      id: "3",
      title: "Prepare workshop agenda",
      due: new Date(2026, 10, 16),
      assignee: "Jonas Pick",
      related: "Deal · Shop migration",
    },
    {
      id: "4",
      title: "Ask for two references",
      due: new Date(2026, 10, 19),
      priority: "low",
      assignee: "Lea Brandt",
      related: "Company · Nordhafen Outdoor",
    },
    { id: "5", title: "Clean up duplicate contacts" },
    {
      id: "6",
      title: "Book the kick-off room",
      due: new Date(2026, 10, 12),
      done: true,
      assignee: "Jonas Pick",
    },
  ]);
  return (
    <Panel title="Tasks" style={{ maxWidth: 680 }}>
      <TaskList
        tasks={tasks}
        today={new Date(2026, 10, 16)}
        onOpen={() => {}}
        onToggle={(id, done) =>
          setTasks((all) => all.map((x) => (x.id === id ? { ...x, done } : x)))
        }
      />
    </Panel>
  );
}
```

## Props

### TaskList

| Prop | Type | Notes |
| --- | --- | --- |
| `tasks` | `CrmTask[]` | Required |
| `today?` | `Date \| string \| number` | The day that counts as today; pass it so server and client render the same. |
| `onToggle?` | `(id: string, done: boolean) => void` |  |
| `onOpen?` | `(id: string) => void` |  |
| `grouped?` | `boolean` | Groups: overdue, today, upcoming, no date, done (default true). |
| `label?` | `string` | Accessible name (default "Tasks"). |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |

### Panel

| Prop | Type | Notes |
| --- | --- | --- |
| `side?` | `boolean` |  |
| `title?` | `string` |  |
| `subtitle?` | `string` |  |
| `action?` | `ReactNode` |  |
| `children?` | `ReactNode` |  |
| `surface?` | `Surface` | `"glass"`: translucent glass over what is behind (maps, 3D, video, photos); `"solid"` opts out inside a glass `UIProvider`. |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |
