Task list The task list component displays a list of related tasks the user needs to do, and allows
them to easily identify which ones are done and which they still need to do.
You can have multiple tasks lists on a page. Where you have multiple tasks lists, you must add a unique id_prefix
to each one.
Task statuses can either contain plain text, or can contain a govuk_tag
.
Output
<h2 class= "govuk-heading-m" >
About you
</h2>
<ul class= "govuk-task-list" >
<li class= "govuk-task-list__item govuk-task-list__item--with-link" >
<div class= "govuk-task-list__name-and-hint" >
<a class= "govuk-link govuk-task-list__link" aria-describedby= "about-you-1-status" href= "#" >
Personal details
</a>
</div>
<div class= "govuk-task-list__status" id= "about-you-1-status" >
Completed
</div>
</li>
<li class= "govuk-task-list__item govuk-task-list__item--with-link" >
<div class= "govuk-task-list__name-and-hint" >
<a class= "govuk-link govuk-task-list__link" aria-describedby= "about-you-2-status" href= "#" >
Contact details
</a>
</div>
<div class= "govuk-task-list__status" id= "about-you-2-status" >
<strong class= "govuk-tag govuk-tag--blue" >
Incomplete
</strong>
</div>
</li>
</ul>
<h2 class= "govuk-heading-m" >
Your project
</h2>
<ul class= "govuk-task-list" >
<li class= "govuk-task-list__item govuk-task-list__item--with-link" >
<div class= "govuk-task-list__name-and-hint" >
<a class= "govuk-link govuk-task-list__link" aria-describedby= "your-project-1-status" href= "#" >
Project description
</a>
</div>
<div class= "govuk-task-list__status" id= "your-project-1-status" >
Completed
</div>
</li>
<li class= "govuk-task-list__item govuk-task-list__item--with-link" >
<div class= "govuk-task-list__name-and-hint" >
<a class= "govuk-link govuk-task-list__link" aria-describedby= "your-project-2-status" href= "#" >
Funding
</a>
</div>
<div class= "govuk-task-list__status" id= "your-project-2-status" >
<strong class= "govuk-tag govuk-tag--blue" >
Incomplete
</strong>
</div>
</li>
</ul>
The tags can be given different colours by passing a colour
keyword.
When an explanation is needed to better describe a task, hints can be added
with the hint
keyword on either with_item
or with_title
.
Output
<ul class= "govuk-task-list" >
<li class= "govuk-task-list__item govuk-task-list__item--with-link" >
<div class= "govuk-task-list__name-and-hint" >
<a class= "govuk-link govuk-task-list__link" aria-describedby= "task-list-with-hints-1-status task-list-with-hints-1-hint" href= "#" >
Check your qualifications
</a>
<div class= "govuk-task-list__hint" id= "task-list-with-hints-1-hint" >
You need GCSEs in English and maths
</div>
</div>
<div class= "govuk-task-list__status" id= "task-list-with-hints-1-status" >
<strong class= "govuk-tag govuk-tag--green" >
Done
</strong>
</div>
</li>
<li class= "govuk-task-list__item govuk-task-list__item--with-link" >
<div class= "govuk-task-list__name-and-hint" >
<a class= "govuk-link govuk-task-list__link" aria-describedby= "task-list-with-hints-2-status task-list-with-hints-2-hint" href= "#" >
Understand funding
</a>
<div class= "govuk-task-list__hint" id= "task-list-with-hints-2-hint" >
Teacher training course fees are around £9,250 per year
</div>
</div>
<div class= "govuk-task-list__status" id= "task-list-with-hints-2-status" >
<strong class= "govuk-tag govuk-tag--green" >
Done
</strong>
</div>
</li>
<li class= "govuk-task-list__item govuk-task-list__item--with-link" >
<div class= "govuk-task-list__name-and-hint" >
<a class= "govuk-link govuk-task-list__link" aria-describedby= "task-list-with-hints-3-status task-list-with-hints-3-hint" href= "#" >
Consider getting experience
</a>
<div class= "govuk-task-list__hint" id= "task-list-with-hints-3-hint" >
Experiencing life in a school can help you decide if teaching is right for you
</div>
</div>
<div class= "govuk-task-list__status" id= "task-list-with-hints-3-status" >
<strong class= "govuk-tag govuk-tag--yellow" >
Arranged
</strong>
</div>
</li>
<li class= "govuk-task-list__item govuk-task-list__item--with-link" >
<div class= "govuk-task-list__name-and-hint" >
<a class= "govuk-link govuk-task-list__link" aria-describedby= "task-list-with-hints-4-status task-list-with-hints-4-hint" href= "#" >
Find a teacher training course
</a>
<div class= "govuk-task-list__hint" id= "task-list-with-hints-4-hint" >
Through teacher training you can get QTS, a PGCE, or both
</div>
</div>
<div class= "govuk-task-list__status" id= "task-list-with-hints-4-status" >
<strong class= "govuk-tag govuk-tag--red" >
To do
</strong>
</div>
</li>
</ul>
Tasks can omit the href
keyword if they cannot be started yet. When doing this you should add cannot_start_yet: true
to the status, and a hint to explain why the task cannot be started yet.
Output
Completed
Completed
Funding
The funds will be announced on 1 April 2022
Cannot start yet
<ul class= "govuk-task-list" >
<li class= "govuk-task-list__item govuk-task-list__item--with-link" >
<div class= "govuk-task-list__name-and-hint" >
<a class= "govuk-link govuk-task-list__link" aria-describedby= "project-tasks-1-status" href= "#" >
Contact details
</a>
</div>
<div class= "govuk-task-list__status" id= "project-tasks-1-status" >
Completed
</div>
</li>
<li class= "govuk-task-list__item govuk-task-list__item--with-link" >
<div class= "govuk-task-list__name-and-hint" >
<a class= "govuk-link govuk-task-list__link" aria-describedby= "project-tasks-2-status" href= "#" >
Project details
</a>
</div>
<div class= "govuk-task-list__status" id= "project-tasks-2-status" >
Completed
</div>
</li>
<li class= "govuk-task-list__item" >
<div class= "govuk-task-list__name-and-hint" >
Funding
<div class= "govuk-task-list__hint" id= "project-tasks-3-hint" >
The funds will be announced on 1 April 2022
</div>
</div>
<div class= "govuk-task-list__status govuk-task-list__status--cannot-start-yet" id= "project-tasks-3-status" >
Cannot start yet
</div>
</li>
</ul>
If you need to customise the task list, you can add custom modifier classes to the task list, items, titles or statuses.
You can also add additional html attributes using the html_attributes
keyword.
Output
<ul class= "govuk-task-list app-task-list--my-modifier" data-my-key= "my-value" >
<li class= "govuk-task-list__item app-task-list__item--my-modifier govuk-task-list__item--with-link" >
<div class= "govuk-task-list__name-and-hint app-task-list__name-and-hint--my-modifier" >
<a class= "govuk-link govuk-task-list__link" aria-describedby= "task-list-with-custom-classes-1-status" href= "#" >
Personal details
</a>
</div>
<div class= "govuk-task-list__status app-task-list__status--my-modifier" id= "task-list-with-custom-classes-1-status" >
Completed
</div>
</li>
<li class= "govuk-task-list__item app-task-list__item--my-modifier govuk-task-list__item--with-link" >
<div class= "govuk-task-list__name-and-hint app-task-list__name-and-hint--my-modifier" >
<a class= "govuk-link govuk-task-list__link" aria-describedby= "task-list-with-custom-classes-2-status" href= "#" >
Contact information
</a>
</div>
<div class= "govuk-task-list__status app-task-list__status--my-modifier" id= "task-list-with-custom-classes-2-status" >
Completed
</div>
</li>
</ul>