-
Notifications
You must be signed in to change notification settings - Fork 46
Create new pattern for using cards to navigate content #2392
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4695f3f
Create new pattern for using cards to navigate content
sarawilcox 855e50e
Attempt example of hub page
sarawilcox cd15ede
Iterate hub page content
sarawilcox 0a83329
tiny tweaks to example code
anandamaryon1 47af9b8
Fix examples not pulling through
sarawilcox 5f109b6
Add link to GitHub issue for hub page
sarawilcox 3725a13
Add 2 lines of text after feedback
sarawilcox File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
app/views/design-system/patterns/hub-page/example/index.njk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| --- | ||
| previewLayout: design-example-wrapper-full | ||
| --- | ||
|
|
||
| {% extends "layouts/design-example-wrapper-full-layout.njk" %} | ||
|
|
||
| {% from "card/macro.njk" import card %} | ||
| {% from "breadcrumb/macro.njk" import breadcrumb %} | ||
|
|
||
| {% block beforeContent %} | ||
| {{ breadcrumb({ | ||
| items: [ | ||
| { | ||
| href: "#", | ||
| text: "Home" | ||
| } | ||
| ] | ||
| }) }} | ||
| {% endblock %} | ||
|
|
||
| {% block content %} | ||
|
|
||
| <h1 class="nhsuk-heading-xl">NHS services</h1> | ||
| <p class="nhsuk-body-l">Find out about NHS services such as GPs, pharmacies and hospitals, services near you, and online services to manage your health</p> | ||
|
|
||
| <ul class="nhsuk-grid-row nhsuk-card-group"> | ||
| <li class="nhsuk-grid-column-one-third nhsuk-card-group__item"> | ||
| {{ card({ | ||
| href: "#", | ||
| clickable: "true", | ||
| headingLevel: 5, | ||
| heading: "Order a repeat prescription", | ||
| headingClasses: "nhsuk-heading-xs" | ||
| }) }} | ||
| </li> | ||
| </ul> | ||
|
|
||
| <ul class="nhsuk-grid-row nhsuk-card-group"> | ||
| <li class="nhsuk-grid-column-one-half nhsuk-card-group__item"> | ||
| {{ card({ | ||
| href: "#", | ||
| primary: "true", | ||
| clickable: "true", | ||
| heading: "GPs", | ||
| headingClasses: "nhsuk-heading-m", | ||
| description: "About GP services, including how to find and register with a local GP and how to book an appointment" | ||
| }) }} | ||
| </li> | ||
| <li class="nhsuk-grid-column-one-half nhsuk-card-group__item"> | ||
| {{ card({ | ||
| href: "#", | ||
| primary: "true", | ||
| clickable: "true", | ||
| heading: "Hospitals", | ||
| headingClasses: "nhsuk-heading-m", | ||
| description: "About NHS hospitals, booking and changing appointments with the NHS e-Referral Service and going into hospital" | ||
| }) }} | ||
| </li> | ||
| <li class="nhsuk-grid-column-one-half nhsuk-card-group__item"> | ||
| {{ card({ | ||
| href: "#", | ||
| primary: "true", | ||
| clickable: "true", | ||
| heading: "Dentists", | ||
| headingClasses: "nhsuk-heading-m", | ||
| description: "About NHS dental services, how to find an NHS dentist and how much treatment costs" | ||
| }) }} | ||
| </li> | ||
| <li class="nhsuk-grid-column-one-half nhsuk-card-group__item"> | ||
| {{ card({ | ||
| href: "#", | ||
| primary: "true", | ||
| clickable: "true", | ||
| heading: "Prescriptions", | ||
| headingClasses: "nhsuk-heading-m", | ||
| description: "Find out about prescriptions including charges, repeat prescriptions and if you can get free prescriptions" | ||
| }) }} | ||
| </li> | ||
| </ul> | ||
|
|
||
| <ul class="nhsuk-grid-row nhsuk-card-group"> | ||
| <li class="nhsuk-grid-column-one-half nhsuk-card-group__item"> | ||
| {{ card({ | ||
| href: "#", | ||
| clickable: "true", | ||
| secondary: "true", | ||
| heading: "Services A to Z", | ||
| headingClasses: "nhsuk-heading-m", | ||
| description: "Use our service finder to find other health services" | ||
| }) }} | ||
| </li> | ||
| <li class="nhsuk-grid-column-one-half nhsuk-card-group__item"> | ||
| {{ card({ | ||
| href: "#", | ||
| clickable: "true", | ||
| secondary: "true", | ||
| heading: "Online services", | ||
| headingClasses: "nhsuk-heading-m", | ||
| description: "Get your NHS number and find out how to view test results online" | ||
| }) }} | ||
| </li> | ||
| </ul> | ||
|
|
||
| {% endblock %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| {% extends "layouts/app-layout.njk" %} | ||
|
|
||
| {% set pageTitle = "Hub page" %} | ||
| {% set pageDescription = "Hub pages use cards to help users navigate to the content they need." %} | ||
| {% set pageSection = "Design system" %} | ||
| {% set subSection = "Patterns" %} | ||
| {% set theme = "Pages" %} | ||
| {% set dateUpdated = "December 2025" %} | ||
| {% set backlog_issue_id = "260" %} | ||
|
|
||
| {% block beforeContent %} | ||
| {% include "design-system/patterns/_breadcrumb.njk" %} | ||
| {% endblock %} | ||
|
|
||
| {% block bodyContent %} | ||
|
|
||
| {{ designExample({ | ||
| group: "patterns", | ||
| item: "hub-page", | ||
| type: "example" | ||
| }) }} | ||
|
|
||
| <h2 id="when-to-use-this-pattern">When to use this pattern</h2> | ||
| <p>Use clickable <a href="/design-system/components/card">cards</a> on hub pages to signpost groupings of related content and help users find the content they need.</p> | ||
| <p>Hub pages work well on large websites. For smaller sites, other components may be enough, for example:</p> | ||
| <ul> | ||
| <li><a href="/design-system/components/header#navigation">header navigation</a></li> | ||
| <li><a href="/design-system/patterns/mini-hub">a mini-hub</a></li> | ||
| <li>a simple list of links</li> | ||
| </ul> | ||
|
|
||
| <h2 id="when-not-to-use-this-pattern">When not to use this pattern</h2> | ||
| <p>Do not use this pattern as a substitute for a clear information architecture. Use the header component, for example, to provide consistent navigation.</p> | ||
| <p>Do not use cards to help users navigate a transactional journey. But you may use them to help people find your service <a href="/design-system/patterns/start-page">start page</a>.</p> | ||
|
|
||
| <h2 id="how-this-pattern-works">How this pattern works</h2> | ||
| <p>This pattern uses 3 types of clickable card, the:</p> | ||
| <ul> | ||
| <li><a href="#top-task-card">top task card</a></li> | ||
| <li><a href="#primary-card-with-chevron">primary card with chevron</a></li> | ||
| <li><a href="#secondary-card">secondary card</a></li> | ||
| </ul> | ||
| <p>Hub pages should include primary cards. They do not need to include top task cards or secondary cards.</p> | ||
| <p>Group cards to show a collection of related topics. Prioritise the cards so the content users need most comes first.</p> | ||
| <p>Use different card styles to help users understand the importance of different groups of cards.</p> | ||
|
|
||
| <h3 id="top-task-card">Top task card</h3> | ||
|
|
||
| {{ designExample({ | ||
| group: "patterns", | ||
| item: "hub-page", | ||
| type: "top-task" | ||
| }) }} | ||
|
|
||
| <p>Top task cards are small clickable cards.</p> | ||
| <p>Use them at the top of hub pages above other cards (such as primary cards) to help users quickly access specific information or tasks buried deeper in the navigation. Use them as shortcuts to content or services that are popular with users or meet an important business need.</p> | ||
| <p>If you want to link to a page just below the hub page, use a primary card instead.</p> | ||
| <p>Do not use more than 3 top tasks on a hub page.</p> | ||
|
|
||
| <h3 id="primary-card-with-chevron">Primary card (with chevron)</h3> | ||
|
|
||
| {{ designExample({ | ||
| group: "patterns", | ||
| item: "hub-page", | ||
| type: "primary-card" | ||
| }) }} | ||
|
|
||
| <p>Use primary cards on hub pages to signpost groups of information that are important to users.</p> | ||
| <p>You can include a primary card that links to a single page at a lower level if other primary cards on the same hub page link to groups of content.</p> | ||
| <p>The chevron icon (from our <a href="/design-system/styles/icons">icon set</a>) helps users know the card will take them to more content. The size of the card helps them understand that the topics these cards link to are more frequently visited or more important than topics signposted by secondary cards.</p> | ||
| <p>Include a heading, with a link, and descriptive text.</p> | ||
|
|
||
| <h3 id="secondary-card">Secondary card</h3> | ||
|
|
||
| {{ designExample({ | ||
| group: "patterns", | ||
| item: "hub-page", | ||
| type: "secondary-card" | ||
| }) }} | ||
|
|
||
| <p>Use secondary cards on hub pages to signpost groups of information on less important topics. Use them below primary cards which signpost important information.</p> | ||
| <p>Secondary cards have less visual impact than top tasks or primary cards.</p> | ||
| <p>Include a heading, with a link, and descriptive text.</p> | ||
|
|
||
| <h2 id="research">Research</h2> | ||
|
|
||
| <p>We tested these 3 card variations as part of an iterative process to improve the NHS website's information architecture and navigation patterns.</p> | ||
| <p>We tested the cards in usability sessions and monitored analytics to understand how successful they were.</p> | ||
|
|
||
| {% endblock %} | ||
14 changes: 14 additions & 0 deletions
14
app/views/design-system/patterns/hub-page/primary-card/index.njk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| {% from "card/macro.njk" import card %} | ||
|
|
||
| <ul class="nhsuk-grid-row nhsuk-card-group"> | ||
| <li class="nhsuk-grid-column-two-thirds nhsuk-card-group__item"> | ||
| {{ card({ | ||
| href: "#", | ||
| primary: "true", | ||
| clickable: "true", | ||
| heading: "GPs", | ||
| headingClasses: "nhsuk-heading-m", | ||
| description: "About GP services, including how to find and register with a local GP and how to book an appointment" | ||
| }) }} | ||
| </li> | ||
| </ul> |
14 changes: 14 additions & 0 deletions
14
app/views/design-system/patterns/hub-page/secondary-card/index.njk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| {% from "card/macro.njk" import card %} | ||
|
|
||
| <ul class="nhsuk-grid-row nhsuk-card-group"> | ||
| <li class="nhsuk-grid-column-two-thirds nhsuk-card-group__item"> | ||
| {{ card({ | ||
| href: "#", | ||
| clickable: "true", | ||
| secondary: "true", | ||
| heading: "Services A to Z", | ||
| headingClasses: "nhsuk-heading-m", | ||
| description: "Use our service finder to find other health services" | ||
| }) }} | ||
| </li> | ||
| </ul> |
13 changes: 13 additions & 0 deletions
13
app/views/design-system/patterns/hub-page/top-task/index.njk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| {% from "card/macro.njk" import card %} | ||
|
|
||
| <ul class="nhsuk-grid-row nhsuk-card-group"> | ||
| <li class="nhsuk-grid-column-one-third nhsuk-card-group__item"> | ||
| {{ card({ | ||
| href: "#", | ||
| clickable: "true", | ||
| headingLevel: 5, | ||
| heading: "Order a repeat prescription", | ||
| headingClasses: "nhsuk-heading-xs" | ||
| }) }} | ||
| </li> | ||
| </ul> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.