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.
| Prop | Type |
|---|---|
idPrefixOptional prefix. This is used to prefix the | string |
itemsPrefer 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
| Prop | Type |
|---|---|
withLink | boolean |
TaskList.ItemComposite
idPrefix prefixes the hint and status ids.
| Prop | Type |
|---|---|
idPrefixRequiredThis is used to prefix the | string |
titleRequiredThe main title for the task within the task list component. | ReactNode |
hrefThe value of the link’s | string |
hintCan be used to add a hint to each task within the task list component. | ReactNode |
statusRequiredThe status for each task within the task list component. | ReactNode |
cannotStartYet | boolean |
TaskList.Link
| Prop | Type |
|---|---|
asChildRender the only child (such as a router's link) instead of an | boolean |
TaskList.NameAndHint
No props of its own. Other props are passed to the element it renders.
TaskList.Status
| Prop | Type |
|---|---|
cannotStartYet | boolean |
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.