# Task Row

A row in a Gantt task list: either a task with its color, assignee and dates, or a group header that folds open and closed.

- Category: Data & Tables
- Page: https://wunderui.com/components/task-row
- Tier: Core and Pro

## Install

Task Row ships with WunderUI Core and Pro in the @wunderui/react package.

## Import

```tsx
import { TaskRow, TaskRowProps } from "@wunderui/react"
```

## Minimal usage

Then use it:

```tsx
import { TaskRow } from "@wunderui/react"

export function Plan() {
  return (
    <div className="overflow-hidden rounded-xl border border-border bg-card">
      <TaskRow name="Wireframes" barClassName="bg-primary" assignee={{ name: "Priya Raman", color: "purple" }} dates="Nov 9 – Nov 13" className="border-b-0" />
    </div>
  )
}
```

Expected result: One row with a short indigo bar, the name Wireframes, a purple PR avatar and the dates at the right.

## When to use

### Use Task Row for

- The task column of a Gantt or timeline view, with groups that fold
- A task list where each row has an owner, a status colour and a date
- A project plan that is read more often than it is edited

### Use something else

- [Checklist Task](https://wunderui.com/components/checklist-task) for a step in an onboarding checklist with a title, a description and a state
- [Kanban](https://wunderui.com/components/kanban) for a task on a board, with labels, a due date and assignees
- [Table](https://wunderui.com/components/table) for tasks that are sorted, filtered or compared across several columns

## Keyboard

A group row is a native button with one tab stop. A task row is a plain div with none, and controls beside it, such as a checkbox, take focus in their own order.

| Key | Action |
|---|---|
| `Tab` or `Shift+Tab` | Moves focus to the next or previous group row, and to any control you placed in a task row. A focused group row gets the indigo focus outline on its edge. |
| `Enter` or `Space` | Presses the focused group row and calls `onToggle`; the page then flips `open`. |

Arrow keys don't move between rows. Build the list as a ul so a screen reader announces its length, and keep the DOM order the same as the screen order.

## Behavior

What the row does with state, content, the DOM and motion.

- **Task and group:** A task shows the bar, name, assignee and dates. A group is a button with a chevron and the name that reports expanded or collapsed, and it hides no rows itself, so render them only while open.
- **States:** A task row is static, with no hover, pressed or focus look. A group row lightens on hover, goes subtle while pressed and shows the indigo focus outline on the keyboard, and the chevron flips at once.
- **Columns and width:** The name takes the free width and is cut with an ellipsis. The assignee (64 px) and dates (96 px) columns keep their width, so below about 320 px hide them in a narrow list.
- **Dates and status:** Dates and name take any content, so a due date can be coloured or a finished task struck through. The row has no check, done or overdue state of its own.
- **Avatar:** An assignee with a photo shows it and keeps the initials as fallback. Without a photo the initials sit on a tint, purple by default, and the person's name is the avatar's title.
- **Names for assistive technology:** A group button is announced as expanded or collapsed and points at the region it controls. A task reads as plain text, name then dates, and the bar isn't announced, so put status in text.
- **Motion and reduced motion:** A group's fill fades quickly on hover, and instantly with reduced motion. Nothing moves, and folding a group shows or hides the rows at once.

## Anatomy

- `TaskRow`: The row, as high as a control (36 px, 40 px at comfortable density), with 16 px side padding and 16 px between columns. A task is a div with a 1 px rule under it, a group is a button.
- `Bar`: A 20 px wide, 4 px high rounded bar in front of the name. It is primary by default, can take a status colour, and is not announced.
- `Name`: The name in 14 px text on one line. It takes the free width and is cut with an ellipsis, and a group name is semibold.
- `Assignee`: A centred 24 px avatar of the assignee in a 64 px column. The column stays when there is nobody.
- `Dates`: The dates in 11 px tertiary text, right-aligned in a 96 px column.

## Best practices

### When to use

- Use Task Row in the left list of a timeline or Gantt view, or in a plain task list where each row has an owner and a date. For an onboarding checklist step, use Checklist Task.

### Do

- Use group rows for collapsible sections. Pass the id of the region that holds the rows so the button also sets aria-controls.
- Give each status one bar colour, such as green for done and red for at risk, and keep the mapping the same across the page.
- Say the status in text too. The bar is just a picture, so put Done or Overdue in the dates or name where a screen reader reads it.
- Add what the row lacks yourself: a checkbox in front of it in a list item, a struck-through name, coloured dates.
- Hide the assignee and dates columns with a class in a narrow list. The row never drops them by itself.

### Don't

- Don't pass an assignee or dates to a group row. It shows only the name.
- Don't treat the row as a button for the whole task. A task row is static with no hover or focus look, so put the action in a control inside your own wrapper.
- Don't put a long sentence in the dates. The column is 96 px wide and doesn't wrap.

## API reference

### TaskRow

| Prop | Type | Default | Description |
|---|---|---|---|
| name* | React.ReactNode |  | The name of the task or the group, on one line. It takes any node, for example a span that strikes a finished task through. Required. |
| assignee | Person |  | `{ name, initials?, src?, color? }`: a 24 px avatar in a 64 px column. Without `src` it shows the initials on the tint of `color` (default `purple`). The column stays when there is no assignee. |
| barClassName | string | "bg-primary" | A background class for the bar in front of the name, for example `bg-success`. Default `bg-primary`. |
| className | string |  | Added to the row, after the built-in classes. Use it for `border-b-0` on the last row of a box, a height, or classes that hide the assignee and dates columns. |
| controls | string |  | For a group: the id of the region that holds its rows. It sets `aria-controls` on the button, so a screen reader can jump to the rows the button shows or hides. |
| dates | React.ReactNode |  | The dates, for example `Nov 9 – Nov 13`, in a 96 px column at the right. Text or a node; it does not wrap. |
| group | boolean |  | Makes the row a group header: a button with a chevron and the name. The bar, the assignee and the dates are not drawn. |
| onToggle | () => void |  | For a group: called when the button is pressed with the pointer, Enter or Space. Flip `open` in it and show or hide the rows. |
| open | boolean | true | For a group: whether its rows are shown. It sets `aria-expanded` and the direction of the chevron. Default `true`. |

## Examples

### Type: a task, a group or a folded group

### Status: the color of the bar

### Assignee: a photo, initials from the name, a chosen color or nobody

### Dates: a range, a single day, an overdue date or none

### Width: a row in a column of 480, 320 or 240 px, and a compact row

## In context

### Task list: a check, an assignee and a due date that is overdue, today or later

Checking a task turns the bar green, strikes the name through and replaces the date with Done. Open tasks past their date show it in red, and the filter shows all, open or done tasks.

### Plan: groups that fold open and closed

Each group row is one button: Enter and Space fold it, and it says whether the rows under it are shown. Two buttons fold or unfold every group, and the status line counts the open groups.

## For AI agents

`get_component("task-row")`

Hand your agent this page as Markdown or the WunderUI MCP server, not a screenshot.
