Skip to main content
Components

Task list

The task list component displays all the tasks a user needs to do, and allows users to easily identify which ones are done and which they still need to do.

Children are ItemComposites. With items, each idPrefix defaults to idPrefix and its position.

Read the Design System guidance for task list

Import

import * as TaskList from 'govuk-react/task-list';

Examples

Default

Code
<TaskList.Composite>
  <TaskList.ItemComposite idPrefix="company-details-1" title="Company Directors" href="#" status="Completed" />
  <TaskList.ItemComposite
    idPrefix="company-details-2"
    title="Registered company details"
    href="#"
    status={<Tag colour="blue">Incomplete</Tag>}
  />
  <TaskList.ItemComposite
    idPrefix="company-details-3"
    title="Financial history"
    href="#"
    hint="Include 5 years of the company’s relevant financial information"
    status={<Tag colour="blue">Incomplete</Tag>}
  />
  <TaskList.ItemComposite
    idPrefix="company-details-4"
    title="Business plan"
    href="#"
    status={<Tag colour="blue">Incomplete</Tag>}
  />
  <TaskList.ItemComposite
    idPrefix="company-details-5"
    title="References"
    href="#"
    status={<Tag colour="blue">Incomplete</Tag>}
  />
</TaskList.Composite>

With parts

Code
<TaskList.Root>
  <TaskList.Item withLink>
    <TaskList.NameAndHint>
      <TaskList.Link href="#" aria-describedby="directors-status">
        Company Directors
      </TaskList.Link>
    </TaskList.NameAndHint>
    <TaskList.Status id="directors-status">Completed</TaskList.Status>
  </TaskList.Item>
  <TaskList.Item withLink>
    <TaskList.NameAndHint>
      <TaskList.Link href="#" aria-describedby="details-status">
        Registered company details
      </TaskList.Link>
    </TaskList.NameAndHint>
    <TaskList.Status id="details-status">
      <Tag colour="blue">Incomplete</Tag>
    </TaskList.Status>
  </TaskList.Item>
  <TaskList.Item>
    <TaskList.NameAndHint>
      <div>Submit</div>
    </TaskList.NameAndHint>
    <TaskList.Status id="submit-status" cannotStartYet>
      Cannot start yet
    </TaskList.Status>
  </TaskList.Item>
</TaskList.Root>

API reference

TaskList.Root

The task list component displays all the tasks a user needs to do, and allows users to easily identify which ones are done and which they still need to do.

No props of its own. Other props are passed to the element it renders.

TaskList.Composite

The task list component displays all the tasks a user needs to do, and allows users to easily identify which ones are done and which they still need to do.

Children are ItemComposites. With items, each idPrefix defaults to idPrefix and its position.

PropType
idPrefix

Optional prefix. This is used to prefix the id attribute for the task list item tag and hint, separated by -. Defaults to "task-list".

string
items

Prefer children, which memoise and re-render better.

(Omit<ItemCompositeProps, "idPrefix"> & { idPrefix?: string; })[]

TaskList.Hint

No props of its own. Other props are passed to the element it renders.

TaskList.Item

PropType
withLinkboolean

TaskList.ItemComposite

idPrefix prefixes the hint and status ids.

PropType
idPrefixRequired

This is used to prefix the id attribute for the task list item tag and hint, separated by -.

string
titleRequired

The main title for the task within the task list component.

ReactNode
href

The value of the link’s href attribute for the task list item.

string
hint

Can be used to add a hint to each task within the task list component.

ReactNode
statusRequired

The status for each task within the task list component.

ReactNode
cannotStartYetboolean
PropType
asChild

Render the only child (such as a router's link) instead of an a, with the link classes merged onto it.

boolean

TaskList.NameAndHint

No props of its own. Other props are passed to the element it renders.

TaskList.Status

PropType
cannotStartYetboolean

TaskList.Title

The task's name when it has no link.

No props of its own. Other props are passed to the element it renders.