Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add task list component and pattern #2031

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# NHS digital service manual Changelog


## Unreleased

- Add new Task list component
- Add new Complete multiple tasks pattern

## 7.0.0 - 19 September 2024

:new: **New features**
Expand Down Expand Up @@ -116,7 +122,7 @@
- Remove embedded link from contents list design example
- Fix link in section on link text in accessibility guidance

## 6.1.0 - 18 January 2024
## 6.1.0 - 18 January 2024

:new: **New features**

Expand Down
4 changes: 2 additions & 2 deletions app/views/design-system/components/tag/colours/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</td>
<td class="nhsuk-table__cell">
{{ tag({
text: "Started",
text: "In progress",
classes: "nhsuk-tag--white"
})}}
</td>
Expand All @@ -25,7 +25,7 @@
</td>
<td class="nhsuk-table__cell">
{{ tag({
text: "Not started",
text: "Inactive",
classes: "nhsuk-tag--grey"
})}}
</td>
Expand Down
63 changes: 63 additions & 0 deletions app/views/design-system/components/task-list/default/index.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{% from "task-list/macro.njk" import taskList %}

{{ taskList({
idPrefix: "your-health",
items: [
{
title: {
text: "Exercise"
},
href: "#",
status: {
text: "Completed",
classes: "nhsuk-task-list__status--completed"
}
},
{
title: {
text: "Personal health"
},
href: "#",
status: {
text: "Completed",
classes: "nhsuk-task-list__status--completed"
}
},
{
title: {
text: "Family health history"
},
hint: {
text: "Details of your parents, brothers and sisters"
},
href: "#",
status: {
tag: {
text: "Incomplete",
classes: "nhsuk-tag--blue"
}
}
},
{
title: {
text: "Smoking history"
},
href: "#",
status: {
tag: {
text: "Incomplete",
classes: "nhsuk-tag--blue"
}
}
},
{
title: {
text: "Blood test"
},
status: {
text: "Cannot start yet",
classes: "nhsuk-task-list__status--cannot-start-yet"
}
}
]
}) }}
69 changes: 69 additions & 0 deletions app/views/design-system/components/task-list/index.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{% set pageTitle = "Task list" %}
{% set pageSection = "Design system" %}
{% set subSection = "Components" %}
{% set pageDescription = "Use the task list to give users more control over how they complete long, complex services." %}
{% set theme = "Content presentation" %}
{% set dateUpdated = "October 2024" %}
{% set backlog_issue_id = "304" %}

{% extends "includes/app-layout.njk" %}

{% block breadcrumb %}
{% include "design-system/components/_breadcrumb.njk" %}
{% endblock %}

{% block bodyContent %}

<p>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.</p>

{{ designExample({
group: "components",
item: "task-list",
type: "default"
}) }}

<h2 id="when-to-use-the-task-list">When to use the task list</h2>

<p>If your users have to get through a long or complex service, use the task list to give them more control. For example, if some users cannot complete the tasks in one sitting.</p>
<p>You can also use a task list to allow users to complete tasks in the order they choose. This will help them plan their time and complete sections as and when they can.</p>

<h2 id="when-not-to-use-the-task-list">When not to use the task list</h2>
<p>Try to simplify the service before you use a task list. If you're able to reduce the number of tasks or steps involved, you might not need one.</p>
<p>The task list should not be used as a way of showing users their answers. For this, you should use a <a href="/design-system/components/summary-list/">summary list</a> instead.</p>

<h2 id="how-the-task-list-works">How the task list works</h2>

<p>Where possible, users should be able to complete tasks in whatever order they like.</p>
<p>The status alongside the task indicates whether they can start it. Users can select a task to start completing it. Once they have completed it and returned to the task list, the status for that task will have changed to "Completed".</p>
<p>Users can only move on from the task list when all tasks are shown as "Completed".</p>
<p>Find more information about how to use the task list within a service in the <a href="/design-system/patterns/complete-multiple-tasks/">complete multiple tasks pattern guidance</a>.</p>

<h3 id="tasks">Tasks</h3>

<p>Tasks are usually actions that the user needs to take to complete a service.</p>
<p>Each task within a task list includes a task name and a status. It can also include hint text if you decide this is needed.</p>
<p>The whole row is linked, allowing users to select anywhere within it to start the task.</p>

<h4>Write clear task descriptions</h4>
<p>The task name gives users a reasonable expectation of what that task is about. For example, "Your contact details" or "Upload evidence". Use sentence case, and keep it short. Users of screen readers might find it difficult to navigate the task list if the task names are too long.</p>
<p>If you're finding it difficult to come up with a clear and concise task name, it might be because the task itself is too complex and may need to be separated into smaller tasks. Group questions and actions into tasks in a way that makes sense to users, based on their needs.</p>

<h4>Adding hint text</h4>
<p>Only use hint text if there is evidence that the user needs more information about what the task will include.</p>
<p>Keep hint text to a single, short sentence. Screen readers read out the entire text when users interact with the task link. This could frustrate users if the text is long.</p>
<p>Do not include links within the hint text. The whole task row links users to the task itself, so any links within the hint text will not work.</p>

<h4>Grouping tasks</h4>
<p>If there are a lot of tasks to complete, you might find that grouping them makes it easier for users to understand and plan what they need to do. Tasks can be grouped into separate task lists on a page. Give each task list a short heading that clearly explains the grouping.</p>
<p>Find more information on grouping tasks in the <a href="/design-system/patterns/complete-multiple-tasks#group-tasks-into-steps">complete multiple tasks pattern guidance</a>.</p>

<h3 id="statuses">Statuses</h3>
<p>Statuses use colour and a short descriptor to give users a quick overview of how much of the task list they have completed, and how much is left to do.</p>
<p>Find more information on how to use statuses in the <a href="/design-system/patterns/complete-multiple-tasks#show-the-status-of-the-tasks">complete multiple tasks pattern guidance.</a></p>

<h2 id="research-on-the-task-list">Research on the task list</h2>
<p>The GOV.UK design system developed and tested this component. Find out more about their research on the <a href="https://design-system.service.gov.uk/components/task-list/">GOV.UK task list page</a>.</p>

<p>If you are using this component in a service, we would like to hear about any user research so that we can identify any potential issues.</p>

{% endblock %}
121 changes: 121 additions & 0 deletions app/views/design-system/components/task-list/macro-options.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
{
"name": "task-list",
"params": [
{
"name": "classes",
"type": "string",
"required": false,
"description": "Classes to add to the `ul` container for the task list."
},
{
"name": "attributes",
"type": "object",
"required": false,
"description": "HTML attributes (for example data attributes) to add to the `ul` container for the task list."
},
{
"name": "idPrefix",
"type": "string",
"required": false,
"description": "Optional prefix. This is used to prefix the `id` attribute for the task list item tag and hint, separated by `-`. Defaults to \"task-list\"."
},
{
"name": "items",
"type": "array",
"required": true,
"description": "The items for each task within the task list component. See items.",
"params": [
{
"name": "title",
"type": "object",
"required": true,
"description": "The main title for the task within the task list component. See title.",
"params": [
{
"name": "text",
"type": "string",
"required": true,
"description": "Text to use within the title. If `html` is provided, the `text` argument will be ignored."
},
{
"name": "html",
"type": "string",
"required": true,
"description": "HTML to use within the title. If `html` is provided, the `text` argument will be ignored."
},
{
"name": "classes",
"type": "string",
"required": false,
"description": "Classes to add to the title wrapper."
}
]
},
{
"name": "hint",
"type": "object",
"required": false,
"description": "Can be used to add a hint to each task within the task list component. See items hint.",
"params": [
{
"name": "text",
"type": "string",
"required": true,
"description": "Text to use within the hint. If `html` is provided, the `text` argument will be ignored."
},
{
"name": "html",
"type": "string",
"required": true,
"description": "HTML to use within the hint. If `html` is provided, the `text` argument will be ignored."
}
]
},
{
"name": "status",
"type": "object",
"required": true,
"description": "The status for each task within the task list component. See items status.",
"params": [
{
"name": "tag",
"type": "object",
"required": false,
"description": "Can be used to add a tag to the status of the task within the task list component. See tag."
},
{
"name": "text",
"type": "string",
"required": false,
"description": "Text to use for the status, as an alternative to using a tag. If `html` or `tag` is provided, the `text` argument will be ignored."
},
{
"name": "html",
"type": "string",
"required": false,
"description": "HTML to use for the status, as an alternative to using a tag. If `html` or `tag` is provided, the `text` argument will be ignored."
},
{
"name": "classes",
"type": "string",
"required": false,
"description": "Classes to add to the status container."
}
]
},
{
"name": "href",
"type": "string",
"required": false,
"description": "The value of the link's `href` attribute for the task list item."
},
{
"name": "classes",
"type": "string",
"required": false,
"description": "Classes to add to the item `div`."
}
]
}
]
}
Loading