Card links
Use card links to help users reach the next stage of their NHS App journey.
Nunjucks macro options
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
Some options are required for the macro to work; these are marked as "Required" in the option description.
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.
| Name | Type | Required | Description |
|---|---|---|---|
| title | string | yes | The card title text. Renders as: link (if href), heading (if headingLevel and no href), else a paragraph. |
| href | string | conditional | Makes the title a link when provided. |
| linkAriaLabel | string | no | aria-label for the title link. Use only if the visible text is not clear. |
| headingLevel | number | conditional | Heading level (2–6) used only when there is no href. If not set (and no href) the title is a paragraph. |
| titleClasses | string | no | Classes for the title element. |
| containerClasses | string | no | Classes for the inner container. |
| description | string | conditional | Plain text description below the title. Ignored if descriptionHtml is given. |
| descriptionHtml | string | conditional | HTML description (allows markup). Overrides description. |
| descriptionClasses | string | no | Classes for the description. |
| aboveContent.html | string | no | HTML shown above the title (for example a tag). |
| footer.html | string | no | HTML shown in the footer. |
| img{}.src | string | conditional | Image URL. Adds an image section when present. |
| img{}.alt | string | no | Image alt text. Leave empty only if purely decorative. |
| badgeLarge{}.count | number | conditional | Number for the large badge. Badge appears only when count > 0. |
| badgeLarge{}.label | string | yes | Visually hidden text read after the number. |
| badgeLarge{}.id | string | no | ID attribute for the badge. |
| badgeLarge{}.classes | string | no | Classes for the badge. |
| badgeLarge{}.attributes | object | no | HTML attributes for the badge (e.g. data-*, aria-*). |
| id | string | no | ID for the card. |
| classes | string | no | Classes for the card. |
| attributes | object | no | HTML attributes for the card (e.g. data-*, aria-*). |
To use the component in your design, add the NHS App Figma library to your working files, and navigate using the components tab.
To use the component in your Vue application, install the NHS App Vue Component Library and import the component.
When to use
Use card links to take users:
- to the start of an NHS App service
- deeper into an area of the app
How to use
Use the variation below that fits best with the context.
Short card link
Use a concise phrase to explain where the link goes.
Nunjucks macro options
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
Some options are required for the macro to work; these are marked as "Required" in the option description.
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.
| Name | Type | Required | Description |
|---|---|---|---|
| title | string | yes | The card title text. Renders as: link (if href), heading (if headingLevel and no href), else a paragraph. |
| href | string | conditional | Makes the title a link when provided. |
| linkAriaLabel | string | no | aria-label for the title link. Use only if the visible text is not clear. |
| headingLevel | number | conditional | Heading level (2–6) used only when there is no href. If not set (and no href) the title is a paragraph. |
| titleClasses | string | no | Classes for the title element. |
| containerClasses | string | no | Classes for the inner container. |
| description | string | conditional | Plain text description below the title. Ignored if descriptionHtml is given. |
| descriptionHtml | string | conditional | HTML description (allows markup). Overrides description. |
| descriptionClasses | string | no | Classes for the description. |
| aboveContent.html | string | no | HTML shown above the title (for example a tag). |
| footer.html | string | no | HTML shown in the footer. |
| img{}.src | string | conditional | Image URL. Adds an image section when present. |
| img{}.alt | string | no | Image alt text. Leave empty only if purely decorative. |
| badgeLarge{}.count | number | conditional | Number for the large badge. Badge appears only when count > 0. |
| badgeLarge{}.label | string | yes | Visually hidden text read after the number. |
| badgeLarge{}.id | string | no | ID attribute for the badge. |
| badgeLarge{}.classes | string | no | Classes for the badge. |
| badgeLarge{}.attributes | object | no | HTML attributes for the badge (e.g. data-*, aria-*). |
| id | string | no | ID for the card. |
| classes | string | no | Classes for the card. |
| attributes | object | no | HTML attributes for the card (e.g. data-*, aria-*). |
To use the component in your design, add the NHS App Figma library to your working files, and navigate using the components tab.
To use the component in your Vue application, install the NHS App Vue Component Library and import the component.
Card link with description
Only use this variation if you have found a user need for more detailed links.
Nunjucks macro options
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
Some options are required for the macro to work; these are marked as "Required" in the option description.
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.
| Name | Type | Required | Description |
|---|---|---|---|
| title | string | yes | The card title text. Renders as: link (if href), heading (if headingLevel and no href), else a paragraph. |
| href | string | conditional | Makes the title a link when provided. |
| linkAriaLabel | string | no | aria-label for the title link. Use only if the visible text is not clear. |
| headingLevel | number | conditional | Heading level (2–6) used only when there is no href. If not set (and no href) the title is a paragraph. |
| titleClasses | string | no | Classes for the title element. |
| containerClasses | string | no | Classes for the inner container. |
| description | string | conditional | Plain text description below the title. Ignored if descriptionHtml is given. |
| descriptionHtml | string | conditional | HTML description (allows markup). Overrides description. |
| descriptionClasses | string | no | Classes for the description. |
| aboveContent.html | string | no | HTML shown above the title (for example a tag). |
| footer.html | string | no | HTML shown in the footer. |
| img{}.src | string | conditional | Image URL. Adds an image section when present. |
| img{}.alt | string | no | Image alt text. Leave empty only if purely decorative. |
| badgeLarge{}.count | number | conditional | Number for the large badge. Badge appears only when count > 0. |
| badgeLarge{}.label | string | yes | Visually hidden text read after the number. |
| badgeLarge{}.id | string | no | ID attribute for the badge. |
| badgeLarge{}.classes | string | no | Classes for the badge. |
| badgeLarge{}.attributes | object | no | HTML attributes for the badge (e.g. data-*, aria-*). |
| id | string | no | ID for the card. |
| classes | string | no | Classes for the card. |
| attributes | object | no | HTML attributes for the card (e.g. data-*, aria-*). |
To use the component in your design, add the NHS App Figma library to your working files, and navigate using the components tab.
To use the component in your Vue application, install the NHS App Vue Component Library and import the component.
Badges on card links
Use badges on card links to alert users to new, important information.
Nunjucks macro options
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
Some options are required for the macro to work; these are marked as "Required" in the option description.
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.
| Name | Type | Required | Description |
|---|---|---|---|
| title | string | yes | The card title text. Renders as: link (if href), heading (if headingLevel and no href), else a paragraph. |
| href | string | conditional | Makes the title a link when provided. |
| linkAriaLabel | string | no | aria-label for the title link. Use only if the visible text is not clear. |
| headingLevel | number | conditional | Heading level (2–6) used only when there is no href. If not set (and no href) the title is a paragraph. |
| titleClasses | string | no | Classes for the title element. |
| containerClasses | string | no | Classes for the inner container. |
| description | string | conditional | Plain text description below the title. Ignored if descriptionHtml is given. |
| descriptionHtml | string | conditional | HTML description (allows markup). Overrides description. |
| descriptionClasses | string | no | Classes for the description. |
| aboveContent.html | string | no | HTML shown above the title (for example a tag). |
| footer.html | string | no | HTML shown in the footer. |
| img{}.src | string | conditional | Image URL. Adds an image section when present. |
| img{}.alt | string | no | Image alt text. Leave empty only if purely decorative. |
| badgeLarge{}.count | number | conditional | Number for the large badge. Badge appears only when count > 0. |
| badgeLarge{}.label | string | yes | Visually hidden text read after the number. |
| badgeLarge{}.id | string | no | ID attribute for the badge. |
| badgeLarge{}.classes | string | no | Classes for the badge. |
| badgeLarge{}.attributes | object | no | HTML attributes for the badge (e.g. data-*, aria-*). |
| id | string | no | ID for the card. |
| classes | string | no | Classes for the card. |
| attributes | object | no | HTML attributes for the card (e.g. data-*, aria-*). |
To use the component in your design, add the NHS App Figma library to your working files, and navigate using the components tab.
To use the component in your Vue application, install the NHS App Vue Component Library and import the component.
Secondary card links
Use secondary card links to signpost information that is less important in the context of the page.
Nunjucks macro options
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
Some options are required for the macro to work; these are marked as "Required" in the option description.
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.
| Name | Type | Required | Description |
|---|---|---|---|
| title | string | yes | The card title text. Renders as: link (if href), heading (if headingLevel and no href), else a paragraph. |
| href | string | conditional | Makes the title a link when provided. |
| linkAriaLabel | string | no | aria-label for the title link. Use only if the visible text is not clear. |
| headingLevel | number | conditional | Heading level (2–6) used only when there is no href. If not set (and no href) the title is a paragraph. |
| titleClasses | string | no | Classes for the title element. |
| containerClasses | string | no | Classes for the inner container. |
| description | string | conditional | Plain text description below the title. Ignored if descriptionHtml is given. |
| descriptionHtml | string | conditional | HTML description (allows markup). Overrides description. |
| descriptionClasses | string | no | Classes for the description. |
| aboveContent.html | string | no | HTML shown above the title (for example a tag). |
| footer.html | string | no | HTML shown in the footer. |
| img{}.src | string | conditional | Image URL. Adds an image section when present. |
| img{}.alt | string | no | Image alt text. Leave empty only if purely decorative. |
| badgeLarge{}.count | number | conditional | Number for the large badge. Badge appears only when count > 0. |
| badgeLarge{}.label | string | yes | Visually hidden text read after the number. |
| badgeLarge{}.id | string | no | ID attribute for the badge. |
| badgeLarge{}.classes | string | no | Classes for the badge. |
| badgeLarge{}.attributes | object | no | HTML attributes for the badge (e.g. data-*, aria-*). |
| id | string | no | ID for the card. |
| classes | string | no | Classes for the card. |
| attributes | object | no | HTML attributes for the card (e.g. data-*, aria-*). |
To use the component in your design, add the NHS App Figma library to your working files, and navigate using the components tab.
To use the component in your Vue application, install the NHS App Vue Component Library and import the component.
Colour variations
You can use colour to highlight a card link. This can help draw attention to important content.
Use colour sparingly and make sure there is enough contrast between text and background.
Nunjucks macro options
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
Some options are required for the macro to work; these are marked as "Required" in the option description.
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.
| Name | Type | Required | Description |
|---|---|---|---|
| heading | string | conditional | Text to use for the heding of the card group. If headingHtml is provided, the heading argument will be ignored. |
| headingHtml | string | conditional | HTML to use for the heading of the card group. If headingHtml is provided, the heading argument will be ignored. |
| headingLevel | number | conditional | Heading level (2–6) for the heading. Defaults to 2 when not set. If headingHtml is provided, the headingLevel argument will be ignored. |
| description | string | conditional | Plain text shown under the group heading. If descriptionHtml is provided, the description argument will be ignored. |
| descriptionHtml | string | conditional | HTML version of the description. If descriptionHtml is provided, the description argument will be ignored.. |
| stacked | boolean | no | Adds nhsapp-cards--stacked class to card group. |
| isListItem | boolean | no | If true (default) wrapper is <ul> with each card as <li>. If false uses <div> wrappers. |
| id | string | no | ID for the card group. |
| classes | string | no | Classes for the card group. |
| attributes | object | no | HTML attributes for the card group (data-_ or aria-_). |
| cards | array | yes | Array of card objects. |
| cards[]title | string | yes | The card title text. Renders as: link (if href), heading (if headingLevel and no href), else a paragraph. |
| cards[]href | string | conditional | Makes the title a link when provided. |
| cards[]linkAriaLabel | string | no | aria-label for the title link. Use only if the visible text is not clear. |
| cards[]headingLevel | number | conditional | Heading level (2–6) used only when there is no href. If not set (and no href) the title is a paragraph. |
| cards[]titleClasses | string | no | Classes for the title element. |
| cards[]containerClasses | string | no | Classes for the inner container. |
| cards[]description | string | conditional | Plain text description below the title. Ignored if descriptionHtml is given. |
| cards[]descriptionHtml | string | conditional | HTML description (allows markup). Overrides description. |
| cards[]descriptionClasses | string | no | Classes for the description. |
| cards[]aboveContent.html | string | no | HTML shown above the title (for example a tag). |
| cards[]footer.html | string | no | HTML shown in the footer. |
| cards[]img{}.src | string | conditional | Image URL. Adds an image section when present. |
| cards[]img{}.alt | string | no | Image alt text. Leave empty only if purely decorative. |
| cards[]badgeLarge{}.count | number | conditional | Number for the large badge. Badge appears only when count > 0. |
| cards[]badgeLarge{}.label | string | yes | Visually hidden text read after the number. |
| cards[]badgeLarge{}.id | string | no | ID attribute for the badge. |
| cards[]badgeLarge{}.classes | string | no | Classes for the badge. |
| cards[]badgeLarge{}.attributes | object | no | HTML attributes for the badge (e.g. data-*, aria-*). |
| cards[]id | string | no | ID for the card. |
| cards[]classes | string | no | Classes for the card. |
| cards[]attributes | object | no | HTML attributes for the card (e.g. data-*, aria-*). |
Images on card links
You can add an image to a card link. We use this on the home screen of the NHS App to help users learn about public health campaigns.
Nunjucks macro options
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
Some options are required for the macro to work; these are marked as "Required" in the option description.
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.
| Name | Type | Required | Description |
|---|---|---|---|
| title | string | yes | The card title text. Renders as: link (if href), heading (if headingLevel and no href), else a paragraph. |
| href | string | conditional | Makes the title a link when provided. |
| linkAriaLabel | string | no | aria-label for the title link. Use only if the visible text is not clear. |
| headingLevel | number | conditional | Heading level (2–6) used only when there is no href. If not set (and no href) the title is a paragraph. |
| titleClasses | string | no | Classes for the title element. |
| containerClasses | string | no | Classes for the inner container. |
| description | string | conditional | Plain text description below the title. Ignored if descriptionHtml is given. |
| descriptionHtml | string | conditional | HTML description (allows markup). Overrides description. |
| descriptionClasses | string | no | Classes for the description. |
| aboveContent.html | string | no | HTML shown above the title (for example a tag). |
| footer.html | string | no | HTML shown in the footer. |
| img{}.src | string | conditional | Image URL. Adds an image section when present. |
| img{}.alt | string | no | Image alt text. Leave empty only if purely decorative. |
| badgeLarge{}.count | number | conditional | Number for the large badge. Badge appears only when count > 0. |
| badgeLarge{}.label | string | yes | Visually hidden text read after the number. |
| badgeLarge{}.id | string | no | ID attribute for the badge. |
| badgeLarge{}.classes | string | no | Classes for the badge. |
| badgeLarge{}.attributes | object | no | HTML attributes for the badge (e.g. data-*, aria-*). |
| id | string | no | ID for the card. |
| classes | string | no | Classes for the card. |
| attributes | object | no | HTML attributes for the card (e.g. data-*, aria-*). |
Custom content on card links
You can add custom content to a card link, such as a tag, appointment time and location.
Keep the content short and easy to scan. Test with users to check the card gives them the right amount of information.
Nunjucks macro options
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
Some options are required for the macro to work; these are marked as "Required" in the option description.
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.
| Name | Type | Required | Description |
|---|---|---|---|
| title | string | yes | The card title text. Renders as: link (if href), heading (if headingLevel and no href), else a paragraph. |
| href | string | conditional | Makes the title a link when provided. |
| linkAriaLabel | string | no | aria-label for the title link. Use only if the visible text is not clear. |
| headingLevel | number | conditional | Heading level (2–6) used only when there is no href. If not set (and no href) the title is a paragraph. |
| titleClasses | string | no | Classes for the title element. |
| containerClasses | string | no | Classes for the inner container. |
| description | string | conditional | Plain text description below the title. Ignored if descriptionHtml is given. |
| descriptionHtml | string | conditional | HTML description (allows markup). Overrides description. |
| descriptionClasses | string | no | Classes for the description. |
| aboveContent.html | string | no | HTML shown above the title (for example a tag). |
| footer.html | string | no | HTML shown in the footer. |
| img{}.src | string | conditional | Image URL. Adds an image section when present. |
| img{}.alt | string | no | Image alt text. Leave empty only if purely decorative. |
| badgeLarge{}.count | number | conditional | Number for the large badge. Badge appears only when count > 0. |
| badgeLarge{}.label | string | yes | Visually hidden text read after the number. |
| badgeLarge{}.id | string | no | ID attribute for the badge. |
| badgeLarge{}.classes | string | no | Classes for the badge. |
| badgeLarge{}.attributes | object | no | HTML attributes for the badge (e.g. data-*, aria-*). |
| id | string | no | ID for the card. |
| classes | string | no | Classes for the card. |
| attributes | object | no | HTML attributes for the card (e.g. data-*, aria-*). |
To use the component in your Vue application, install the NHS App Vue Component Library and import the component.
Footers on card links
You can use a footer to separate related content inside a card link.
Card with no link
Use when the card content is informational only and requires no user interaction.
Nunjucks macro options
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
Some options are required for the macro to work; these are marked as "Required" in the option description.
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.
| Name | Type | Required | Description |
|---|---|---|---|
| title | string | yes | The card title text. Renders as: link (if href), heading (if headingLevel and no href), else a paragraph. |
| href | string | conditional | Makes the title a link when provided. |
| linkAriaLabel | string | no | aria-label for the title link. Use only if the visible text is not clear. |
| headingLevel | number | conditional | Heading level (2–6) used only when there is no href. If not set (and no href) the title is a paragraph. |
| titleClasses | string | no | Classes for the title element. |
| containerClasses | string | no | Classes for the inner container. |
| description | string | conditional | Plain text description below the title. Ignored if descriptionHtml is given. |
| descriptionHtml | string | conditional | HTML description (allows markup). Overrides description. |
| descriptionClasses | string | no | Classes for the description. |
| aboveContent.html | string | no | HTML shown above the title (for example a tag). |
| footer.html | string | no | HTML shown in the footer. |
| img{}.src | string | conditional | Image URL. Adds an image section when present. |
| img{}.alt | string | no | Image alt text. Leave empty only if purely decorative. |
| badgeLarge{}.count | number | conditional | Number for the large badge. Badge appears only when count > 0. |
| badgeLarge{}.label | string | yes | Visually hidden text read after the number. |
| badgeLarge{}.id | string | no | ID attribute for the badge. |
| badgeLarge{}.classes | string | no | Classes for the badge. |
| badgeLarge{}.attributes | object | no | HTML attributes for the badge (e.g. data-*, aria-*). |
| id | string | no | ID for the card. |
| classes | string | no | Classes for the card. |
| attributes | object | no | HTML attributes for the card (e.g. data-*, aria-*). |
To use the component in your Vue application, install the NHS App Vue Component Library and import the component.
Multiple card links
Multiple card links placed together must be marked up as lists in the HTML code. This helps screen reader users to navigate the content, for example by letting them know how many items there are in the list.
Grouped card links
Use grouped card links to separate distinct groups of content or actions. Each card is visually independent.
Nunjucks macro options
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
Some options are required for the macro to work; these are marked as "Required" in the option description.
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.
| Name | Type | Required | Description |
|---|---|---|---|
| heading | string | conditional | Text to use for the heding of the card group. If headingHtml is provided, the heading argument will be ignored. |
| headingHtml | string | conditional | HTML to use for the heading of the card group. If headingHtml is provided, the heading argument will be ignored. |
| headingLevel | number | conditional | Heading level (2–6) for the heading. Defaults to 2 when not set. If headingHtml is provided, the headingLevel argument will be ignored. |
| description | string | conditional | Plain text shown under the group heading. If descriptionHtml is provided, the description argument will be ignored. |
| descriptionHtml | string | conditional | HTML version of the description. If descriptionHtml is provided, the description argument will be ignored.. |
| stacked | boolean | no | Adds nhsapp-cards--stacked class to card group. |
| isListItem | boolean | no | If true (default) wrapper is <ul> with each card as <li>. If false uses <div> wrappers. |
| id | string | no | ID for the card group. |
| classes | string | no | Classes for the card group. |
| attributes | object | no | HTML attributes for the card group (data-_ or aria-_). |
| cards | array | yes | Array of card objects. |
| cards[]title | string | yes | The card title text. Renders as: link (if href), heading (if headingLevel and no href), else a paragraph. |
| cards[]href | string | conditional | Makes the title a link when provided. |
| cards[]linkAriaLabel | string | no | aria-label for the title link. Use only if the visible text is not clear. |
| cards[]headingLevel | number | conditional | Heading level (2–6) used only when there is no href. If not set (and no href) the title is a paragraph. |
| cards[]titleClasses | string | no | Classes for the title element. |
| cards[]containerClasses | string | no | Classes for the inner container. |
| cards[]description | string | conditional | Plain text description below the title. Ignored if descriptionHtml is given. |
| cards[]descriptionHtml | string | conditional | HTML description (allows markup). Overrides description. |
| cards[]descriptionClasses | string | no | Classes for the description. |
| cards[]aboveContent.html | string | no | HTML shown above the title (for example a tag). |
| cards[]footer.html | string | no | HTML shown in the footer. |
| cards[]img{}.src | string | conditional | Image URL. Adds an image section when present. |
| cards[]img{}.alt | string | no | Image alt text. Leave empty only if purely decorative. |
| cards[]badgeLarge{}.count | number | conditional | Number for the large badge. Badge appears only when count > 0. |
| cards[]badgeLarge{}.label | string | yes | Visually hidden text read after the number. |
| cards[]badgeLarge{}.id | string | no | ID attribute for the badge. |
| cards[]badgeLarge{}.classes | string | no | Classes for the badge. |
| cards[]badgeLarge{}.attributes | object | no | HTML attributes for the badge (e.g. data-*, aria-*). |
| cards[]id | string | no | ID for the card. |
| cards[]classes | string | no | Classes for the card. |
| cards[]attributes | object | no | HTML attributes for the card (e.g. data-*, aria-*). |
To use the component in your Vue application, install the NHS App Vue Component Library and import the component.
Stacked card links
Use stacked card links to show multiple items within a single group, such as different sections of the same service or related tasks.
Nunjucks macro options
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
Some options are required for the macro to work; these are marked as "Required" in the option description.
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.
| Name | Type | Required | Description |
|---|---|---|---|
| heading | string | conditional | Text to use for the heding of the card group. If headingHtml is provided, the heading argument will be ignored. |
| headingHtml | string | conditional | HTML to use for the heading of the card group. If headingHtml is provided, the heading argument will be ignored. |
| headingLevel | number | conditional | Heading level (2–6) for the heading. Defaults to 2 when not set. If headingHtml is provided, the headingLevel argument will be ignored. |
| description | string | conditional | Plain text shown under the group heading. If descriptionHtml is provided, the description argument will be ignored. |
| descriptionHtml | string | conditional | HTML version of the description. If descriptionHtml is provided, the description argument will be ignored.. |
| stacked | boolean | no | Adds nhsapp-cards--stacked class to card group. |
| isListItem | boolean | no | If true (default) wrapper is <ul> with each card as <li>. If false uses <div> wrappers. |
| id | string | no | ID for the card group. |
| classes | string | no | Classes for the card group. |
| attributes | object | no | HTML attributes for the card group (data-_ or aria-_). |
| cards | array | yes | Array of card objects. |
| cards[]title | string | yes | The card title text. Renders as: link (if href), heading (if headingLevel and no href), else a paragraph. |
| cards[]href | string | conditional | Makes the title a link when provided. |
| cards[]linkAriaLabel | string | no | aria-label for the title link. Use only if the visible text is not clear. |
| cards[]headingLevel | number | conditional | Heading level (2–6) used only when there is no href. If not set (and no href) the title is a paragraph. |
| cards[]titleClasses | string | no | Classes for the title element. |
| cards[]containerClasses | string | no | Classes for the inner container. |
| cards[]description | string | conditional | Plain text description below the title. Ignored if descriptionHtml is given. |
| cards[]descriptionHtml | string | conditional | HTML description (allows markup). Overrides description. |
| cards[]descriptionClasses | string | no | Classes for the description. |
| cards[]aboveContent.html | string | no | HTML shown above the title (for example a tag). |
| cards[]footer.html | string | no | HTML shown in the footer. |
| cards[]img{}.src | string | conditional | Image URL. Adds an image section when present. |
| cards[]img{}.alt | string | no | Image alt text. Leave empty only if purely decorative. |
| cards[]badgeLarge{}.count | number | conditional | Number for the large badge. Badge appears only when count > 0. |
| cards[]badgeLarge{}.label | string | yes | Visually hidden text read after the number. |
| cards[]badgeLarge{}.id | string | no | ID attribute for the badge. |
| cards[]badgeLarge{}.classes | string | no | Classes for the badge. |
| cards[]badgeLarge{}.attributes | object | no | HTML attributes for the badge (e.g. data-*, aria-*). |
| cards[]id | string | no | ID for the card. |
| cards[]classes | string | no | Classes for the card. |
| cards[]attributes | object | no | HTML attributes for the card (e.g. data-*, aria-*). |
To use the component in your design, add the NHS App Figma library to your working files, and navigate using the components tab.
To use the component in your Vue application, install the NHS App Vue Component Library and import the component.
Use secondary card links below primary card links which signpost more important information.
Nunjucks macro options
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
Some options are required for the macro to work; these are marked as "Required" in the option description.
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.
| Name | Type | Required | Description |
|---|---|---|---|
| heading | string | conditional | Text to use for the heding of the card group. If headingHtml is provided, the heading argument will be ignored. |
| headingHtml | string | conditional | HTML to use for the heading of the card group. If headingHtml is provided, the heading argument will be ignored. |
| headingLevel | number | conditional | Heading level (2–6) for the heading. Defaults to 2 when not set. If headingHtml is provided, the headingLevel argument will be ignored. |
| description | string | conditional | Plain text shown under the group heading. If descriptionHtml is provided, the description argument will be ignored. |
| descriptionHtml | string | conditional | HTML version of the description. If descriptionHtml is provided, the description argument will be ignored.. |
| stacked | boolean | no | Adds nhsapp-cards--stacked class to card group. |
| isListItem | boolean | no | If true (default) wrapper is <ul> with each card as <li>. If false uses <div> wrappers. |
| id | string | no | ID for the card group. |
| classes | string | no | Classes for the card group. |
| attributes | object | no | HTML attributes for the card group (data-_ or aria-_). |
| cards | array | yes | Array of card objects. |
| cards[]title | string | yes | The card title text. Renders as: link (if href), heading (if headingLevel and no href), else a paragraph. |
| cards[]href | string | conditional | Makes the title a link when provided. |
| cards[]linkAriaLabel | string | no | aria-label for the title link. Use only if the visible text is not clear. |
| cards[]headingLevel | number | conditional | Heading level (2–6) used only when there is no href. If not set (and no href) the title is a paragraph. |
| cards[]titleClasses | string | no | Classes for the title element. |
| cards[]containerClasses | string | no | Classes for the inner container. |
| cards[]description | string | conditional | Plain text description below the title. Ignored if descriptionHtml is given. |
| cards[]descriptionHtml | string | conditional | HTML description (allows markup). Overrides description. |
| cards[]descriptionClasses | string | no | Classes for the description. |
| cards[]aboveContent.html | string | no | HTML shown above the title (for example a tag). |
| cards[]footer.html | string | no | HTML shown in the footer. |
| cards[]img{}.src | string | conditional | Image URL. Adds an image section when present. |
| cards[]img{}.alt | string | no | Image alt text. Leave empty only if purely decorative. |
| cards[]badgeLarge{}.count | number | conditional | Number for the large badge. Badge appears only when count > 0. |
| cards[]badgeLarge{}.label | string | yes | Visually hidden text read after the number. |
| cards[]badgeLarge{}.id | string | no | ID attribute for the badge. |
| cards[]badgeLarge{}.classes | string | no | Classes for the badge. |
| cards[]badgeLarge{}.attributes | object | no | HTML attributes for the badge (e.g. data-*, aria-*). |
| cards[]id | string | no | ID for the card. |
| cards[]classes | string | no | Classes for the card. |
| cards[]attributes | object | no | HTML attributes for the card (e.g. data-*, aria-*). |
To use the component in your design, add the NHS App Figma library to your working files, and navigate using the components tab.
To use the component in your Vue application, install the NHS App Vue Component Library and import the component.
Using headings
Break up long lists of card links by using headings. It makes pages easier to scan and helps screen reader users to navigate.
Nunjucks macro options
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
Some options are required for the macro to work; these are marked as "Required" in the option description.
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.
| Name | Type | Required | Description |
|---|---|---|---|
| heading | string | conditional | Text to use for the heding of the card group. If headingHtml is provided, the heading argument will be ignored. |
| headingHtml | string | conditional | HTML to use for the heading of the card group. If headingHtml is provided, the heading argument will be ignored. |
| headingLevel | number | conditional | Heading level (2–6) for the heading. Defaults to 2 when not set. If headingHtml is provided, the headingLevel argument will be ignored. |
| description | string | conditional | Plain text shown under the group heading. If descriptionHtml is provided, the description argument will be ignored. |
| descriptionHtml | string | conditional | HTML version of the description. If descriptionHtml is provided, the description argument will be ignored.. |
| stacked | boolean | no | Adds nhsapp-cards--stacked class to card group. |
| isListItem | boolean | no | If true (default) wrapper is <ul> with each card as <li>. If false uses <div> wrappers. |
| id | string | no | ID for the card group. |
| classes | string | no | Classes for the card group. |
| attributes | object | no | HTML attributes for the card group (data-_ or aria-_). |
| cards | array | yes | Array of card objects. |
| cards[]title | string | yes | The card title text. Renders as: link (if href), heading (if headingLevel and no href), else a paragraph. |
| cards[]href | string | conditional | Makes the title a link when provided. |
| cards[]linkAriaLabel | string | no | aria-label for the title link. Use only if the visible text is not clear. |
| cards[]headingLevel | number | conditional | Heading level (2–6) used only when there is no href. If not set (and no href) the title is a paragraph. |
| cards[]titleClasses | string | no | Classes for the title element. |
| cards[]containerClasses | string | no | Classes for the inner container. |
| cards[]description | string | conditional | Plain text description below the title. Ignored if descriptionHtml is given. |
| cards[]descriptionHtml | string | conditional | HTML description (allows markup). Overrides description. |
| cards[]descriptionClasses | string | no | Classes for the description. |
| cards[]aboveContent.html | string | no | HTML shown above the title (for example a tag). |
| cards[]footer.html | string | no | HTML shown in the footer. |
| cards[]img{}.src | string | conditional | Image URL. Adds an image section when present. |
| cards[]img{}.alt | string | no | Image alt text. Leave empty only if purely decorative. |
| cards[]badgeLarge{}.count | number | conditional | Number for the large badge. Badge appears only when count > 0. |
| cards[]badgeLarge{}.label | string | yes | Visually hidden text read after the number. |
| cards[]badgeLarge{}.id | string | no | ID attribute for the badge. |
| cards[]badgeLarge{}.classes | string | no | Classes for the badge. |
| cards[]badgeLarge{}.attributes | object | no | HTML attributes for the badge (e.g. data-*, aria-*). |
| cards[]id | string | no | ID for the card. |
| cards[]classes | string | no | Classes for the card. |
| cards[]attributes | object | no | HTML attributes for the card (e.g. data-*, aria-*). |
You can add custom HTML to the heading using headingHtml.
Nunjucks macro options
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
Some options are required for the macro to work; these are marked as "Required" in the option description.
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.
| Name | Type | Required | Description |
|---|---|---|---|
| heading | string | conditional | Text to use for the heding of the card group. If headingHtml is provided, the heading argument will be ignored. |
| headingHtml | string | conditional | HTML to use for the heading of the card group. If headingHtml is provided, the heading argument will be ignored. |
| headingLevel | number | conditional | Heading level (2–6) for the heading. Defaults to 2 when not set. If headingHtml is provided, the headingLevel argument will be ignored. |
| description | string | conditional | Plain text shown under the group heading. If descriptionHtml is provided, the description argument will be ignored. |
| descriptionHtml | string | conditional | HTML version of the description. If descriptionHtml is provided, the description argument will be ignored.. |
| stacked | boolean | no | Adds nhsapp-cards--stacked class to card group. |
| isListItem | boolean | no | If true (default) wrapper is <ul> with each card as <li>. If false uses <div> wrappers. |
| id | string | no | ID for the card group. |
| classes | string | no | Classes for the card group. |
| attributes | object | no | HTML attributes for the card group (data-_ or aria-_). |
| cards | array | yes | Array of card objects. |
| cards[]title | string | yes | The card title text. Renders as: link (if href), heading (if headingLevel and no href), else a paragraph. |
| cards[]href | string | conditional | Makes the title a link when provided. |
| cards[]linkAriaLabel | string | no | aria-label for the title link. Use only if the visible text is not clear. |
| cards[]headingLevel | number | conditional | Heading level (2–6) used only when there is no href. If not set (and no href) the title is a paragraph. |
| cards[]titleClasses | string | no | Classes for the title element. |
| cards[]containerClasses | string | no | Classes for the inner container. |
| cards[]description | string | conditional | Plain text description below the title. Ignored if descriptionHtml is given. |
| cards[]descriptionHtml | string | conditional | HTML description (allows markup). Overrides description. |
| cards[]descriptionClasses | string | no | Classes for the description. |
| cards[]aboveContent.html | string | no | HTML shown above the title (for example a tag). |
| cards[]footer.html | string | no | HTML shown in the footer. |
| cards[]img{}.src | string | conditional | Image URL. Adds an image section when present. |
| cards[]img{}.alt | string | no | Image alt text. Leave empty only if purely decorative. |
| cards[]badgeLarge{}.count | number | conditional | Number for the large badge. Badge appears only when count > 0. |
| cards[]badgeLarge{}.label | string | yes | Visually hidden text read after the number. |
| cards[]badgeLarge{}.id | string | no | ID attribute for the badge. |
| cards[]badgeLarge{}.classes | string | no | Classes for the badge. |
| cards[]badgeLarge{}.attributes | object | no | HTML attributes for the badge (e.g. data-*, aria-*). |
| cards[]id | string | no | ID for the card. |
| cards[]classes | string | no | Classes for the card. |
| cards[]attributes | object | no | HTML attributes for the card (e.g. data-*, aria-*). |
Accessibility
Screen reader users often navigate by pulling up a list of all the links on a page. When they do this, they only hear the link text, not the content around it.
This means your linkAriaLabel must include all the important information from the card. It needs to make sense on its own, out of context.
In this example, a sighted user sees the date, location and 'Action needed' tag laid out visually. A screen reader user hears all of this in the linkAriaLabel: "Action needed: Orthopaedic appointment on Monday 3 June 2024 at 9:40am, at The Willows, Croydon University Hospital".
Nunjucks macro options
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
Some options are required for the macro to work; these are marked as "Required" in the option description.
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.
| Name | Type | Required | Description |
|---|---|---|---|
| title | string | yes | The card title text. Renders as: link (if href), heading (if headingLevel and no href), else a paragraph. |
| href | string | conditional | Makes the title a link when provided. |
| linkAriaLabel | string | no | aria-label for the title link. Use only if the visible text is not clear. |
| headingLevel | number | conditional | Heading level (2–6) used only when there is no href. If not set (and no href) the title is a paragraph. |
| titleClasses | string | no | Classes for the title element. |
| containerClasses | string | no | Classes for the inner container. |
| description | string | conditional | Plain text description below the title. Ignored if descriptionHtml is given. |
| descriptionHtml | string | conditional | HTML description (allows markup). Overrides description. |
| descriptionClasses | string | no | Classes for the description. |
| aboveContent.html | string | no | HTML shown above the title (for example a tag). |
| footer.html | string | no | HTML shown in the footer. |
| img{}.src | string | conditional | Image URL. Adds an image section when present. |
| img{}.alt | string | no | Image alt text. Leave empty only if purely decorative. |
| badgeLarge{}.count | number | conditional | Number for the large badge. Badge appears only when count > 0. |
| badgeLarge{}.label | string | yes | Visually hidden text read after the number. |
| badgeLarge{}.id | string | no | ID attribute for the badge. |
| badgeLarge{}.classes | string | no | Classes for the badge. |
| badgeLarge{}.attributes | object | no | HTML attributes for the badge (e.g. data-*, aria-*). |
| id | string | no | ID for the card. |
| classes | string | no | Classes for the card. |
| attributes | object | no | HTML attributes for the card (e.g. data-*, aria-*). |
To use the component in your design, add the NHS App Figma library to your working files, and navigate using the components tab.
To use the component in your Vue application, install the NHS App Vue Component Library and import the component.
You can mark the visual content as aria-hidden="true" because it's already in the link label. This stops screen reader users hearing the same information twice.
Before you hide content with aria-hidden="true", check it appears in the linkAriaLabel. If it does not, do not hide it. Screen reader users will miss it when they navigate through links.
Research
In our research, people successfully navigated the NHS App and completed a range of tasks using short card links. They understood the meaning of the links despite the short amount of text.
Some people overlooked description text when it was included in card links.
Help improve this component
The NHS App design system team would like to hear:
- how you have used this component in your service
- any feedback you have about its usage, for example accessibility or ideas for improvement
Add these comments to the 'Card links' discussion on GitHub.