Content presentation
–
Card
Use a card to visually group related content and actions to help users do what they need to more quickly.
When to use a card
Use a card to visually group related content and actions to help users do what they need to more quickly. You can group several cards together.
If you are grouping cards to create a hub page (sometimes called a landing page), use the hub page pattern.
When not to use a card
Do not use a card to highlight content on a page of long form content.
Before using a card, consider using:
- the care card pattern to help users decide when and where to get care
- details
- an expander
- inset text
- tabs
- a warning callout
How to use a card
There are two types of cards:
Both cards can be clickable or non-clickable.
A card can include different elements, such as:
- a heading
- text
- a link or links
You can also add an image or add actions. If you include a link, the link should mirror the heading of the page it links to.
For clickable cards, avoid wrapping the entire card in an anchor tag as this can be a difficult experience for screen reader users.
Keep the card short so it is easy to scan for relevant and actionable information.
Primary card
Primary cards are more visually prominent than secondary cards.
Primary card clickable
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. Deprecated options are marked as "Deprecated".
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 | Description |
|---|---|---|
| id | string | The ID of the card. |
| heading | string |
Required.
Text to use within the heading of the card component. If headingHtml is provided, the heading argument will be ignored.
|
|
heading |
string |
Required.
HTML to use within the heading of the card component. If headingHtml is provided, the heading argument will be ignored.
|
|
heading |
string | Classes to add to the card heading. |
|
heading |
string |
Size of the heading – "xss", "xs", "s", "m", "l" or "xl".
|
|
heading |
integer |
Optional heading level for the card heading. Defaults to 2.
|
|
heading |
string |
Optional id attribute for the card heading.
|
|
heading |
string | Optional visually hidden prefix used before the heading. |
| href | string |
The value of the card link href attribute.
|
| clickable | boolean |
If set to true, then the whole card will become a clickable card variant.
|
| variant | string |
Optional variant of card – "feature", "primary", "secondary", "warning", "non-urgent", "urgent" or "emergency".
|
| type | string |
Deprecated in 10.4.0 Optional type of care card – "non-urgent", "urgent" or "emergency". Replaced by the variant option.
|
| feature | boolean |
Deprecated in 10.4.0 If set to true, then the card will become a feature card variant.
|
| primary | boolean |
Deprecated in 10.4.0 If set to true, the card will become a primary card variant (with chevron).
|
| secondary | boolean |
Deprecated in 10.4.0 If set to true, the card will become a secondary card variant.
|
| warning | boolean |
Deprecated in 10.4.0 If set to true, then the card will become a warning card variant used by the warning callout.
|
|
img |
string |
Deprecated in 10.3.0 The URL of the image in the card. Replaced by the image.src option.
|
|
img |
string |
Deprecated in 10.3.0 The alternative text of the image in the card. Replaced by the image.alt option.
|
| image | object | Can be used to add an image to the card component. See macro options for image. |
| description | string |
Text description within the card content. If descriptionHtml is provided, the description argument will be ignored.
|
|
description |
string |
HTML to use within the card content. If descriptionHtml is provided, the description argument will be ignored.
|
| actions | object | Can be used to add actions to the card component. See macro options for actions. |
| caller | nunjucks-block |
Not strictly a parameter but a Nunjucks code convention. Using a call block enables you to call a macro with all the text inside the tag. This is helpful if you want to pass a lot of content into a macro. To use it, you will need to wrap the entire card component in a call block.
|
| classes | string | Classes to add to the card. |
| attributes | object | HTML attributes (for example data attributes) to add to the card. |
| Name | Type | Description |
|---|---|---|
| src | string | Required. The URL of the image in the card. |
| alt | string | The alternative text of the image in the card. |
| html | string |
HTML to use for the image content. If html is provided, the src and alt arguments will be ignored.
|
| Name | Type | Description |
|---|---|---|
| items | array | Array of actions as links for use in the card component. See macro options for actions items. |
| classes | string | Classes to add to the actions wrapper. |
| Name | Type | Description |
|---|---|---|
| href | string |
Required.
The value of the link's href attribute for an action item.
|
| text | string |
Required.
If html is set, this is not required. Text to use within each action item. If html is provided, the text option will be ignored.
|
| html | string |
Required.
If text is set, this is not required. HTML to use within each action item. If html is provided, the text option will be ignored.
|
|
visually |
string |
Actions rely on context from the surrounding content so may require additional accessible text. Text supplied to this option is appended to the end. Use html for more complicated scenarios.
|
| classes | string | Classes to add to the action item. |
| attributes | object | HTML attributes (for example data attributes) to add to the action item. |
Primary card with chevron
The chevron icon on this primary card makes it even more prominent.
There is only a clickable version of this card.
Read about how to use primary cards with chevrons in the hub page pattern.
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. Deprecated options are marked as "Deprecated".
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 | Description |
|---|---|---|
| id | string | The ID of the card. |
| heading | string |
Required.
Text to use within the heading of the card component. If headingHtml is provided, the heading argument will be ignored.
|
|
heading |
string |
Required.
HTML to use within the heading of the card component. If headingHtml is provided, the heading argument will be ignored.
|
|
heading |
string | Classes to add to the card heading. |
|
heading |
string |
Size of the heading – "xss", "xs", "s", "m", "l" or "xl".
|
|
heading |
integer |
Optional heading level for the card heading. Defaults to 2.
|
|
heading |
string |
Optional id attribute for the card heading.
|
|
heading |
string | Optional visually hidden prefix used before the heading. |
| href | string |
The value of the card link href attribute.
|
| clickable | boolean |
If set to true, then the whole card will become a clickable card variant.
|
| variant | string |
Optional variant of card – "feature", "primary", "secondary", "warning", "non-urgent", "urgent" or "emergency".
|
| type | string |
Deprecated in 10.4.0 Optional type of care card – "non-urgent", "urgent" or "emergency". Replaced by the variant option.
|
| feature | boolean |
Deprecated in 10.4.0 If set to true, then the card will become a feature card variant.
|
| primary | boolean |
Deprecated in 10.4.0 If set to true, the card will become a primary card variant (with chevron).
|
| secondary | boolean |
Deprecated in 10.4.0 If set to true, the card will become a secondary card variant.
|
| warning | boolean |
Deprecated in 10.4.0 If set to true, then the card will become a warning card variant used by the warning callout.
|
|
img |
string |
Deprecated in 10.3.0 The URL of the image in the card. Replaced by the image.src option.
|
|
img |
string |
Deprecated in 10.3.0 The alternative text of the image in the card. Replaced by the image.alt option.
|
| image | object | Can be used to add an image to the card component. See macro options for image. |
| description | string |
Text description within the card content. If descriptionHtml is provided, the description argument will be ignored.
|
|
description |
string |
HTML to use within the card content. If descriptionHtml is provided, the description argument will be ignored.
|
| actions | object | Can be used to add actions to the card component. See macro options for actions. |
| caller | nunjucks-block |
Not strictly a parameter but a Nunjucks code convention. Using a call block enables you to call a macro with all the text inside the tag. This is helpful if you want to pass a lot of content into a macro. To use it, you will need to wrap the entire card component in a call block.
|
| classes | string | Classes to add to the card. |
| attributes | object | HTML attributes (for example data attributes) to add to the card. |
| Name | Type | Description |
|---|---|---|
| src | string | Required. The URL of the image in the card. |
| alt | string | The alternative text of the image in the card. |
| html | string |
HTML to use for the image content. If html is provided, the src and alt arguments will be ignored.
|
| Name | Type | Description |
|---|---|---|
| items | array | Array of actions as links for use in the card component. See macro options for actions items. |
| classes | string | Classes to add to the actions wrapper. |
| Name | Type | Description |
|---|---|---|
| href | string |
Required.
The value of the link's href attribute for an action item.
|
| text | string |
Required.
If html is set, this is not required. Text to use within each action item. If html is provided, the text option will be ignored.
|
| html | string |
Required.
If text is set, this is not required. HTML to use within each action item. If html is provided, the text option will be ignored.
|
|
visually |
string |
Actions rely on context from the surrounding content so may require additional accessible text. Text supplied to this option is appended to the end. Use html for more complicated scenarios.
|
| classes | string | Classes to add to the action item. |
| attributes | object | HTML attributes (for example data attributes) to add to the action item. |
Primary card non-clickable
Use the non-clickable card when you are using more than 1 link.
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. Deprecated options are marked as "Deprecated".
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 | Description |
|---|---|---|
| id | string | The ID of the card. |
| heading | string |
Required.
Text to use within the heading of the card component. If headingHtml is provided, the heading argument will be ignored.
|
|
heading |
string |
Required.
HTML to use within the heading of the card component. If headingHtml is provided, the heading argument will be ignored.
|
|
heading |
string | Classes to add to the card heading. |
|
heading |
string |
Size of the heading – "xss", "xs", "s", "m", "l" or "xl".
|
|
heading |
integer |
Optional heading level for the card heading. Defaults to 2.
|
|
heading |
string |
Optional id attribute for the card heading.
|
|
heading |
string | Optional visually hidden prefix used before the heading. |
| href | string |
The value of the card link href attribute.
|
| clickable | boolean |
If set to true, then the whole card will become a clickable card variant.
|
| variant | string |
Optional variant of card – "feature", "primary", "secondary", "warning", "non-urgent", "urgent" or "emergency".
|
| type | string |
Deprecated in 10.4.0 Optional type of care card – "non-urgent", "urgent" or "emergency". Replaced by the variant option.
|
| feature | boolean |
Deprecated in 10.4.0 If set to true, then the card will become a feature card variant.
|
| primary | boolean |
Deprecated in 10.4.0 If set to true, the card will become a primary card variant (with chevron).
|
| secondary | boolean |
Deprecated in 10.4.0 If set to true, the card will become a secondary card variant.
|
| warning | boolean |
Deprecated in 10.4.0 If set to true, then the card will become a warning card variant used by the warning callout.
|
|
img |
string |
Deprecated in 10.3.0 The URL of the image in the card. Replaced by the image.src option.
|
|
img |
string |
Deprecated in 10.3.0 The alternative text of the image in the card. Replaced by the image.alt option.
|
| image | object | Can be used to add an image to the card component. See macro options for image. |
| description | string |
Text description within the card content. If descriptionHtml is provided, the description argument will be ignored.
|
|
description |
string |
HTML to use within the card content. If descriptionHtml is provided, the description argument will be ignored.
|
| actions | object | Can be used to add actions to the card component. See macro options for actions. |
| caller | nunjucks-block |
Not strictly a parameter but a Nunjucks code convention. Using a call block enables you to call a macro with all the text inside the tag. This is helpful if you want to pass a lot of content into a macro. To use it, you will need to wrap the entire card component in a call block.
|
| classes | string | Classes to add to the card. |
| attributes | object | HTML attributes (for example data attributes) to add to the card. |
| Name | Type | Description |
|---|---|---|
| src | string | Required. The URL of the image in the card. |
| alt | string | The alternative text of the image in the card. |
| html | string |
HTML to use for the image content. If html is provided, the src and alt arguments will be ignored.
|
| Name | Type | Description |
|---|---|---|
| items | array | Array of actions as links for use in the card component. See macro options for actions items. |
| classes | string | Classes to add to the actions wrapper. |
| Name | Type | Description |
|---|---|---|
| href | string |
Required.
The value of the link's href attribute for an action item.
|
| text | string |
Required.
If html is set, this is not required. Text to use within each action item. If html is provided, the text option will be ignored.
|
| html | string |
Required.
If text is set, this is not required. HTML to use within each action item. If html is provided, the text option will be ignored.
|
|
visually |
string |
Actions rely on context from the surrounding content so may require additional accessible text. Text supplied to this option is appended to the end. Use html for more complicated scenarios.
|
| classes | string | Classes to add to the action item. |
| attributes | object | HTML attributes (for example data attributes) to add to the action item. |
Secondary card
The secondary card has less visual impact than the primary cards.
When used with other cards, use the secondary card to group less important content or actions.
Secondary card clickable
This card is also used in the hub page pattern.
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. Deprecated options are marked as "Deprecated".
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 | Description |
|---|---|---|
| id | string | The ID of the card. |
| heading | string |
Required.
Text to use within the heading of the card component. If headingHtml is provided, the heading argument will be ignored.
|
|
heading |
string |
Required.
HTML to use within the heading of the card component. If headingHtml is provided, the heading argument will be ignored.
|
|
heading |
string | Classes to add to the card heading. |
|
heading |
string |
Size of the heading – "xss", "xs", "s", "m", "l" or "xl".
|
|
heading |
integer |
Optional heading level for the card heading. Defaults to 2.
|
|
heading |
string |
Optional id attribute for the card heading.
|
|
heading |
string | Optional visually hidden prefix used before the heading. |
| href | string |
The value of the card link href attribute.
|
| clickable | boolean |
If set to true, then the whole card will become a clickable card variant.
|
| variant | string |
Optional variant of card – "feature", "primary", "secondary", "warning", "non-urgent", "urgent" or "emergency".
|
| type | string |
Deprecated in 10.4.0 Optional type of care card – "non-urgent", "urgent" or "emergency". Replaced by the variant option.
|
| feature | boolean |
Deprecated in 10.4.0 If set to true, then the card will become a feature card variant.
|
| primary | boolean |
Deprecated in 10.4.0 If set to true, the card will become a primary card variant (with chevron).
|
| secondary | boolean |
Deprecated in 10.4.0 If set to true, the card will become a secondary card variant.
|
| warning | boolean |
Deprecated in 10.4.0 If set to true, then the card will become a warning card variant used by the warning callout.
|
|
img |
string |
Deprecated in 10.3.0 The URL of the image in the card. Replaced by the image.src option.
|
|
img |
string |
Deprecated in 10.3.0 The alternative text of the image in the card. Replaced by the image.alt option.
|
| image | object | Can be used to add an image to the card component. See macro options for image. |
| description | string |
Text description within the card content. If descriptionHtml is provided, the description argument will be ignored.
|
|
description |
string |
HTML to use within the card content. If descriptionHtml is provided, the description argument will be ignored.
|
| actions | object | Can be used to add actions to the card component. See macro options for actions. |
| caller | nunjucks-block |
Not strictly a parameter but a Nunjucks code convention. Using a call block enables you to call a macro with all the text inside the tag. This is helpful if you want to pass a lot of content into a macro. To use it, you will need to wrap the entire card component in a call block.
|
| classes | string | Classes to add to the card. |
| attributes | object | HTML attributes (for example data attributes) to add to the card. |
| Name | Type | Description |
|---|---|---|
| src | string | Required. The URL of the image in the card. |
| alt | string | The alternative text of the image in the card. |
| html | string |
HTML to use for the image content. If html is provided, the src and alt arguments will be ignored.
|
| Name | Type | Description |
|---|---|---|
| items | array | Array of actions as links for use in the card component. See macro options for actions items. |
| classes | string | Classes to add to the actions wrapper. |
| Name | Type | Description |
|---|---|---|
| href | string |
Required.
The value of the link's href attribute for an action item.
|
| text | string |
Required.
If html is set, this is not required. Text to use within each action item. If html is provided, the text option will be ignored.
|
| html | string |
Required.
If text is set, this is not required. HTML to use within each action item. If html is provided, the text option will be ignored.
|
|
visually |
string |
Actions rely on context from the surrounding content so may require additional accessible text. Text supplied to this option is appended to the end. Use html for more complicated scenarios.
|
| classes | string | Classes to add to the action item. |
| attributes | object | HTML attributes (for example data attributes) to add to the action item. |
Secondary card non-clickable
Use the non-clickable card when you have more than 1 link in the content.
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. Deprecated options are marked as "Deprecated".
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 | Description |
|---|---|---|
| id | string | The ID of the card. |
| heading | string |
Required.
Text to use within the heading of the card component. If headingHtml is provided, the heading argument will be ignored.
|
|
heading |
string |
Required.
HTML to use within the heading of the card component. If headingHtml is provided, the heading argument will be ignored.
|
|
heading |
string | Classes to add to the card heading. |
|
heading |
string |
Size of the heading – "xss", "xs", "s", "m", "l" or "xl".
|
|
heading |
integer |
Optional heading level for the card heading. Defaults to 2.
|
|
heading |
string |
Optional id attribute for the card heading.
|
|
heading |
string | Optional visually hidden prefix used before the heading. |
| href | string |
The value of the card link href attribute.
|
| clickable | boolean |
If set to true, then the whole card will become a clickable card variant.
|
| variant | string |
Optional variant of card – "feature", "primary", "secondary", "warning", "non-urgent", "urgent" or "emergency".
|
| type | string |
Deprecated in 10.4.0 Optional type of care card – "non-urgent", "urgent" or "emergency". Replaced by the variant option.
|
| feature | boolean |
Deprecated in 10.4.0 If set to true, then the card will become a feature card variant.
|
| primary | boolean |
Deprecated in 10.4.0 If set to true, the card will become a primary card variant (with chevron).
|
| secondary | boolean |
Deprecated in 10.4.0 If set to true, the card will become a secondary card variant.
|
| warning | boolean |
Deprecated in 10.4.0 If set to true, then the card will become a warning card variant used by the warning callout.
|
|
img |
string |
Deprecated in 10.3.0 The URL of the image in the card. Replaced by the image.src option.
|
|
img |
string |
Deprecated in 10.3.0 The alternative text of the image in the card. Replaced by the image.alt option.
|
| image | object | Can be used to add an image to the card component. See macro options for image. |
| description | string |
Text description within the card content. If descriptionHtml is provided, the description argument will be ignored.
|
|
description |
string |
HTML to use within the card content. If descriptionHtml is provided, the description argument will be ignored.
|
| actions | object | Can be used to add actions to the card component. See macro options for actions. |
| caller | nunjucks-block |
Not strictly a parameter but a Nunjucks code convention. Using a call block enables you to call a macro with all the text inside the tag. This is helpful if you want to pass a lot of content into a macro. To use it, you will need to wrap the entire card component in a call block.
|
| classes | string | Classes to add to the card. |
| attributes | object | HTML attributes (for example data attributes) to add to the card. |
| Name | Type | Description |
|---|---|---|
| src | string | Required. The URL of the image in the card. |
| alt | string | The alternative text of the image in the card. |
| html | string |
HTML to use for the image content. If html is provided, the src and alt arguments will be ignored.
|
| Name | Type | Description |
|---|---|---|
| items | array | Array of actions as links for use in the card component. See macro options for actions items. |
| classes | string | Classes to add to the actions wrapper. |
| Name | Type | Description |
|---|---|---|
| href | string |
Required.
The value of the link's href attribute for an action item.
|
| text | string |
Required.
If html is set, this is not required. Text to use within each action item. If html is provided, the text option will be ignored.
|
| html | string |
Required.
If text is set, this is not required. HTML to use within each action item. If html is provided, the text option will be ignored.
|
|
visually |
string |
Actions rely on context from the surrounding content so may require additional accessible text. Text supplied to this option is appended to the end. Use html for more complicated scenarios.
|
| classes | string | Classes to add to the action item. |
| attributes | object | HTML attributes (for example data attributes) to add to the action item. |
Adding an image
Only use cards with images if you have evidence that they help your users, for example, where you can show that they motivate users.
Images in a card will be displayed above the heading and text. The image is set as a decorative image by default, with the alternative text being null.
Image card clickable
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. Deprecated options are marked as "Deprecated".
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 | Description |
|---|---|---|
| id | string | The ID of the card. |
| heading | string |
Required.
Text to use within the heading of the card component. If headingHtml is provided, the heading argument will be ignored.
|
|
heading |
string |
Required.
HTML to use within the heading of the card component. If headingHtml is provided, the heading argument will be ignored.
|
|
heading |
string | Classes to add to the card heading. |
|
heading |
string |
Size of the heading – "xss", "xs", "s", "m", "l" or "xl".
|
|
heading |
integer |
Optional heading level for the card heading. Defaults to 2.
|
|
heading |
string |
Optional id attribute for the card heading.
|
|
heading |
string | Optional visually hidden prefix used before the heading. |
| href | string |
The value of the card link href attribute.
|
| clickable | boolean |
If set to true, then the whole card will become a clickable card variant.
|
| variant | string |
Optional variant of card – "feature", "primary", "secondary", "warning", "non-urgent", "urgent" or "emergency".
|
| type | string |
Deprecated in 10.4.0 Optional type of care card – "non-urgent", "urgent" or "emergency". Replaced by the variant option.
|
| feature | boolean |
Deprecated in 10.4.0 If set to true, then the card will become a feature card variant.
|
| primary | boolean |
Deprecated in 10.4.0 If set to true, the card will become a primary card variant (with chevron).
|
| secondary | boolean |
Deprecated in 10.4.0 If set to true, the card will become a secondary card variant.
|
| warning | boolean |
Deprecated in 10.4.0 If set to true, then the card will become a warning card variant used by the warning callout.
|
|
img |
string |
Deprecated in 10.3.0 The URL of the image in the card. Replaced by the image.src option.
|
|
img |
string |
Deprecated in 10.3.0 The alternative text of the image in the card. Replaced by the image.alt option.
|
| image | object | Can be used to add an image to the card component. See macro options for image. |
| description | string |
Text description within the card content. If descriptionHtml is provided, the description argument will be ignored.
|
|
description |
string |
HTML to use within the card content. If descriptionHtml is provided, the description argument will be ignored.
|
| actions | object | Can be used to add actions to the card component. See macro options for actions. |
| caller | nunjucks-block |
Not strictly a parameter but a Nunjucks code convention. Using a call block enables you to call a macro with all the text inside the tag. This is helpful if you want to pass a lot of content into a macro. To use it, you will need to wrap the entire card component in a call block.
|
| classes | string | Classes to add to the card. |
| attributes | object | HTML attributes (for example data attributes) to add to the card. |
| Name | Type | Description |
|---|---|---|
| src | string | Required. The URL of the image in the card. |
| alt | string | The alternative text of the image in the card. |
| html | string |
HTML to use for the image content. If html is provided, the src and alt arguments will be ignored.
|
| Name | Type | Description |
|---|---|---|
| items | array | Array of actions as links for use in the card component. See macro options for actions items. |
| classes | string | Classes to add to the actions wrapper. |
| Name | Type | Description |
|---|---|---|
| href | string |
Required.
The value of the link's href attribute for an action item.
|
| text | string |
Required.
If html is set, this is not required. Text to use within each action item. If html is provided, the text option will be ignored.
|
| html | string |
Required.
If text is set, this is not required. HTML to use within each action item. If html is provided, the text option will be ignored.
|
|
visually |
string |
Actions rely on context from the surrounding content so may require additional accessible text. Text supplied to this option is appended to the end. Use html for more complicated scenarios.
|
| classes | string | Classes to add to the action item. |
| attributes | object | HTML attributes (for example data attributes) to add to the action item. |
Image card non-clickable
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. Deprecated options are marked as "Deprecated".
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 | Description |
|---|---|---|
| id | string | The ID of the card. |
| heading | string |
Required.
Text to use within the heading of the card component. If headingHtml is provided, the heading argument will be ignored.
|
|
heading |
string |
Required.
HTML to use within the heading of the card component. If headingHtml is provided, the heading argument will be ignored.
|
|
heading |
string | Classes to add to the card heading. |
|
heading |
string |
Size of the heading – "xss", "xs", "s", "m", "l" or "xl".
|
|
heading |
integer |
Optional heading level for the card heading. Defaults to 2.
|
|
heading |
string |
Optional id attribute for the card heading.
|
|
heading |
string | Optional visually hidden prefix used before the heading. |
| href | string |
The value of the card link href attribute.
|
| clickable | boolean |
If set to true, then the whole card will become a clickable card variant.
|
| variant | string |
Optional variant of card – "feature", "primary", "secondary", "warning", "non-urgent", "urgent" or "emergency".
|
| type | string |
Deprecated in 10.4.0 Optional type of care card – "non-urgent", "urgent" or "emergency". Replaced by the variant option.
|
| feature | boolean |
Deprecated in 10.4.0 If set to true, then the card will become a feature card variant.
|
| primary | boolean |
Deprecated in 10.4.0 If set to true, the card will become a primary card variant (with chevron).
|
| secondary | boolean |
Deprecated in 10.4.0 If set to true, the card will become a secondary card variant.
|
| warning | boolean |
Deprecated in 10.4.0 If set to true, then the card will become a warning card variant used by the warning callout.
|
|
img |
string |
Deprecated in 10.3.0 The URL of the image in the card. Replaced by the image.src option.
|
|
img |
string |
Deprecated in 10.3.0 The alternative text of the image in the card. Replaced by the image.alt option.
|
| image | object | Can be used to add an image to the card component. See macro options for image. |
| description | string |
Text description within the card content. If descriptionHtml is provided, the description argument will be ignored.
|
|
description |
string |
HTML to use within the card content. If descriptionHtml is provided, the description argument will be ignored.
|
| actions | object | Can be used to add actions to the card component. See macro options for actions. |
| caller | nunjucks-block |
Not strictly a parameter but a Nunjucks code convention. Using a call block enables you to call a macro with all the text inside the tag. This is helpful if you want to pass a lot of content into a macro. To use it, you will need to wrap the entire card component in a call block.
|
| classes | string | Classes to add to the card. |
| attributes | object | HTML attributes (for example data attributes) to add to the card. |
| Name | Type | Description |
|---|---|---|
| src | string | Required. The URL of the image in the card. |
| alt | string | The alternative text of the image in the card. |
| html | string |
HTML to use for the image content. If html is provided, the src and alt arguments will be ignored.
|
| Name | Type | Description |
|---|---|---|
| items | array | Array of actions as links for use in the card component. See macro options for actions items. |
| classes | string | Classes to add to the actions wrapper. |
| Name | Type | Description |
|---|---|---|
| href | string |
Required.
The value of the link's href attribute for an action item.
|
| text | string |
Required.
If html is set, this is not required. Text to use within each action item. If html is provided, the text option will be ignored.
|
| html | string |
Required.
If text is set, this is not required. HTML to use within each action item. If html is provided, the text option will be ignored.
|
|
visually |
string |
Actions rely on context from the surrounding content so may require additional accessible text. Text supplied to this option is appended to the end. Use html for more complicated scenarios.
|
| classes | string | Classes to add to the action item. |
| attributes | object | HTML attributes (for example data attributes) to add to the action item. |
Adding actions
You can add links for 1 or more actions to a card. They show below the heading on small screens and right-aligned on bigger screens.
Card actions cannot be used on clickable cards.
They can be used in summary cards.
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. Deprecated options are marked as "Deprecated".
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 | Description |
|---|---|---|
| id | string | The ID of the card. |
| heading | string |
Required.
Text to use within the heading of the card component. If headingHtml is provided, the heading argument will be ignored.
|
|
heading |
string |
Required.
HTML to use within the heading of the card component. If headingHtml is provided, the heading argument will be ignored.
|
|
heading |
string | Classes to add to the card heading. |
|
heading |
string |
Size of the heading – "xss", "xs", "s", "m", "l" or "xl".
|
|
heading |
integer |
Optional heading level for the card heading. Defaults to 2.
|
|
heading |
string |
Optional id attribute for the card heading.
|
|
heading |
string | Optional visually hidden prefix used before the heading. |
| href | string |
The value of the card link href attribute.
|
| clickable | boolean |
If set to true, then the whole card will become a clickable card variant.
|
| variant | string |
Optional variant of card – "feature", "primary", "secondary", "warning", "non-urgent", "urgent" or "emergency".
|
| type | string |
Deprecated in 10.4.0 Optional type of care card – "non-urgent", "urgent" or "emergency". Replaced by the variant option.
|
| feature | boolean |
Deprecated in 10.4.0 If set to true, then the card will become a feature card variant.
|
| primary | boolean |
Deprecated in 10.4.0 If set to true, the card will become a primary card variant (with chevron).
|
| secondary | boolean |
Deprecated in 10.4.0 If set to true, the card will become a secondary card variant.
|
| warning | boolean |
Deprecated in 10.4.0 If set to true, then the card will become a warning card variant used by the warning callout.
|
|
img |
string |
Deprecated in 10.3.0 The URL of the image in the card. Replaced by the image.src option.
|
|
img |
string |
Deprecated in 10.3.0 The alternative text of the image in the card. Replaced by the image.alt option.
|
| image | object | Can be used to add an image to the card component. See macro options for image. |
| description | string |
Text description within the card content. If descriptionHtml is provided, the description argument will be ignored.
|
|
description |
string |
HTML to use within the card content. If descriptionHtml is provided, the description argument will be ignored.
|
| actions | object | Can be used to add actions to the card component. See macro options for actions. |
| caller | nunjucks-block |
Not strictly a parameter but a Nunjucks code convention. Using a call block enables you to call a macro with all the text inside the tag. This is helpful if you want to pass a lot of content into a macro. To use it, you will need to wrap the entire card component in a call block.
|
| classes | string | Classes to add to the card. |
| attributes | object | HTML attributes (for example data attributes) to add to the card. |
| Name | Type | Description |
|---|---|---|
| src | string | Required. The URL of the image in the card. |
| alt | string | The alternative text of the image in the card. |
| html | string |
HTML to use for the image content. If html is provided, the src and alt arguments will be ignored.
|
| Name | Type | Description |
|---|---|---|
| items | array | Array of actions as links for use in the card component. See macro options for actions items. |
| classes | string | Classes to add to the actions wrapper. |
| Name | Type | Description |
|---|---|---|
| href | string |
Required.
The value of the link's href attribute for an action item.
|
| text | string |
Required.
If html is set, this is not required. Text to use within each action item. If html is provided, the text option will be ignored.
|
| html | string |
Required.
If text is set, this is not required. HTML to use within each action item. If html is provided, the text option will be ignored.
|
|
visually |
string |
Actions rely on context from the surrounding content so may require additional accessible text. Text supplied to this option is appended to the end. Use html for more complicated scenarios.
|
| classes | string | Classes to add to the action item. |
| attributes | object | HTML attributes (for example data attributes) to add to the action item. |
Add a short, relevant and unique card heading which identifies what the card contains. When a screen reader reads out a card action, it also reads out the card heading, making each action link unique.
Write link text that makes it clear what will happen when you click the action. Keep it short and do not add more than 3 actions.
Examples of card actions include:
- delete appointment
- edit appointment
- update issue
- approve application
- cancel order
If the card title includes the word "appointment", for example, you may only need the words "edit" or "delete" in the link text.
If a card action cannot easily be undone or might have serious consequences, consider adding a warning or asking the user for confirmation.
Grouping cards
You can group multiple cards to show a collection of related topics or highlight key information and figures.
If you are grouping cards to create a hub page (sometimes called a landing page), use the hub page pattern.
Card width
We define the width of the cards using the grid system. For example, nhsuk-grid-column-one-half is used to make the cards half width.
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. Deprecated options are marked as "Deprecated".
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 | Description |
|---|---|---|
| id | string | The ID of the card. |
| heading | string |
Required.
Text to use within the heading of the card component. If headingHtml is provided, the heading argument will be ignored.
|
|
heading |
string |
Required.
HTML to use within the heading of the card component. If headingHtml is provided, the heading argument will be ignored.
|
|
heading |
string | Classes to add to the card heading. |
|
heading |
string |
Size of the heading – "xss", "xs", "s", "m", "l" or "xl".
|
|
heading |
integer |
Optional heading level for the card heading. Defaults to 2.
|
|
heading |
string |
Optional id attribute for the card heading.
|
|
heading |
string | Optional visually hidden prefix used before the heading. |
| href | string |
The value of the card link href attribute.
|
| clickable | boolean |
If set to true, then the whole card will become a clickable card variant.
|
| variant | string |
Optional variant of card – "feature", "primary", "secondary", "warning", "non-urgent", "urgent" or "emergency".
|
| type | string |
Deprecated in 10.4.0 Optional type of care card – "non-urgent", "urgent" or "emergency". Replaced by the variant option.
|
| feature | boolean |
Deprecated in 10.4.0 If set to true, then the card will become a feature card variant.
|
| primary | boolean |
Deprecated in 10.4.0 If set to true, the card will become a primary card variant (with chevron).
|
| secondary | boolean |
Deprecated in 10.4.0 If set to true, the card will become a secondary card variant.
|
| warning | boolean |
Deprecated in 10.4.0 If set to true, then the card will become a warning card variant used by the warning callout.
|
|
img |
string |
Deprecated in 10.3.0 The URL of the image in the card. Replaced by the image.src option.
|
|
img |
string |
Deprecated in 10.3.0 The alternative text of the image in the card. Replaced by the image.alt option.
|
| image | object | Can be used to add an image to the card component. See macro options for image. |
| description | string |
Text description within the card content. If descriptionHtml is provided, the description argument will be ignored.
|
|
description |
string |
HTML to use within the card content. If descriptionHtml is provided, the description argument will be ignored.
|
| actions | object | Can be used to add actions to the card component. See macro options for actions. |
| caller | nunjucks-block |
Not strictly a parameter but a Nunjucks code convention. Using a call block enables you to call a macro with all the text inside the tag. This is helpful if you want to pass a lot of content into a macro. To use it, you will need to wrap the entire card component in a call block.
|
| classes | string | Classes to add to the card. |
| attributes | object | HTML attributes (for example data attributes) to add to the card. |
| Name | Type | Description |
|---|---|---|
| src | string | Required. The URL of the image in the card. |
| alt | string | The alternative text of the image in the card. |
| html | string |
HTML to use for the image content. If html is provided, the src and alt arguments will be ignored.
|
| Name | Type | Description |
|---|---|---|
| items | array | Array of actions as links for use in the card component. See macro options for actions items. |
| classes | string | Classes to add to the actions wrapper. |
| Name | Type | Description |
|---|---|---|
| href | string |
Required.
The value of the link's href attribute for an action item.
|
| text | string |
Required.
If html is set, this is not required. Text to use within each action item. If html is provided, the text option will be ignored.
|
| html | string |
Required.
If text is set, this is not required. HTML to use within each action item. If html is provided, the text option will be ignored.
|
|
visually |
string |
Actions rely on context from the surrounding content so may require additional accessible text. Text supplied to this option is appended to the end. Use html for more complicated scenarios.
|
| classes | string | Classes to add to the action item. |
| attributes | object | HTML attributes (for example data attributes) to add to the action item. |
For thirds, use nhsuk-grid-column-one-third.
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. Deprecated options are marked as "Deprecated".
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 | Description |
|---|---|---|
| id | string | The ID of the card. |
| heading | string |
Required.
Text to use within the heading of the card component. If headingHtml is provided, the heading argument will be ignored.
|
|
heading |
string |
Required.
HTML to use within the heading of the card component. If headingHtml is provided, the heading argument will be ignored.
|
|
heading |
string | Classes to add to the card heading. |
|
heading |
string |
Size of the heading – "xss", "xs", "s", "m", "l" or "xl".
|
|
heading |
integer |
Optional heading level for the card heading. Defaults to 2.
|
|
heading |
string |
Optional id attribute for the card heading.
|
|
heading |
string | Optional visually hidden prefix used before the heading. |
| href | string |
The value of the card link href attribute.
|
| clickable | boolean |
If set to true, then the whole card will become a clickable card variant.
|
| variant | string |
Optional variant of card – "feature", "primary", "secondary", "warning", "non-urgent", "urgent" or "emergency".
|
| type | string |
Deprecated in 10.4.0 Optional type of care card – "non-urgent", "urgent" or "emergency". Replaced by the variant option.
|
| feature | boolean |
Deprecated in 10.4.0 If set to true, then the card will become a feature card variant.
|
| primary | boolean |
Deprecated in 10.4.0 If set to true, the card will become a primary card variant (with chevron).
|
| secondary | boolean |
Deprecated in 10.4.0 If set to true, the card will become a secondary card variant.
|
| warning | boolean |
Deprecated in 10.4.0 If set to true, then the card will become a warning card variant used by the warning callout.
|
|
img |
string |
Deprecated in 10.3.0 The URL of the image in the card. Replaced by the image.src option.
|
|
img |
string |
Deprecated in 10.3.0 The alternative text of the image in the card. Replaced by the image.alt option.
|
| image | object | Can be used to add an image to the card component. See macro options for image. |
| description | string |
Text description within the card content. If descriptionHtml is provided, the description argument will be ignored.
|
|
description |
string |
HTML to use within the card content. If descriptionHtml is provided, the description argument will be ignored.
|
| actions | object | Can be used to add actions to the card component. See macro options for actions. |
| caller | nunjucks-block |
Not strictly a parameter but a Nunjucks code convention. Using a call block enables you to call a macro with all the text inside the tag. This is helpful if you want to pass a lot of content into a macro. To use it, you will need to wrap the entire card component in a call block.
|
| classes | string | Classes to add to the card. |
| attributes | object | HTML attributes (for example data attributes) to add to the card. |
| Name | Type | Description |
|---|---|---|
| src | string | Required. The URL of the image in the card. |
| alt | string | The alternative text of the image in the card. |
| html | string |
HTML to use for the image content. If html is provided, the src and alt arguments will be ignored.
|
| Name | Type | Description |
|---|---|---|
| items | array | Array of actions as links for use in the card component. See macro options for actions items. |
| classes | string | Classes to add to the actions wrapper. |
| Name | Type | Description |
|---|---|---|
| href | string |
Required.
The value of the link's href attribute for an action item.
|
| text | string |
Required.
If html is set, this is not required. Text to use within each action item. If html is provided, the text option will be ignored.
|
| html | string |
Required.
If text is set, this is not required. HTML to use within each action item. If html is provided, the text option will be ignored.
|
|
visually |
string |
Actions rely on context from the surrounding content so may require additional accessible text. Text supplied to this option is appended to the end. Use html for more complicated scenarios.
|
| classes | string | Classes to add to the action item. |
| attributes | object | HTML attributes (for example data attributes) to add to the action item. |
When using thirds or quarters, check your content on smaller screens as the cards become narrow. Avoid adding paragraphs of text that will become hard to read.
For quarters, use nhsuk-grid-column-one-quarter.
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. Deprecated options are marked as "Deprecated".
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 | Description |
|---|---|---|
| id | string | The ID of the card. |
| heading | string |
Required.
Text to use within the heading of the card component. If headingHtml is provided, the heading argument will be ignored.
|
|
heading |
string |
Required.
HTML to use within the heading of the card component. If headingHtml is provided, the heading argument will be ignored.
|
|
heading |
string | Classes to add to the card heading. |
|
heading |
string |
Size of the heading – "xss", "xs", "s", "m", "l" or "xl".
|
|
heading |
integer |
Optional heading level for the card heading. Defaults to 2.
|
|
heading |
string |
Optional id attribute for the card heading.
|
|
heading |
string | Optional visually hidden prefix used before the heading. |
| href | string |
The value of the card link href attribute.
|
| clickable | boolean |
If set to true, then the whole card will become a clickable card variant.
|
| variant | string |
Optional variant of card – "feature", "primary", "secondary", "warning", "non-urgent", "urgent" or "emergency".
|
| type | string |
Deprecated in 10.4.0 Optional type of care card – "non-urgent", "urgent" or "emergency". Replaced by the variant option.
|
| feature | boolean |
Deprecated in 10.4.0 If set to true, then the card will become a feature card variant.
|
| primary | boolean |
Deprecated in 10.4.0 If set to true, the card will become a primary card variant (with chevron).
|
| secondary | boolean |
Deprecated in 10.4.0 If set to true, the card will become a secondary card variant.
|
| warning | boolean |
Deprecated in 10.4.0 If set to true, then the card will become a warning card variant used by the warning callout.
|
|
img |
string |
Deprecated in 10.3.0 The URL of the image in the card. Replaced by the image.src option.
|
|
img |
string |
Deprecated in 10.3.0 The alternative text of the image in the card. Replaced by the image.alt option.
|
| image | object | Can be used to add an image to the card component. See macro options for image. |
| description | string |
Text description within the card content. If descriptionHtml is provided, the description argument will be ignored.
|
|
description |
string |
HTML to use within the card content. If descriptionHtml is provided, the description argument will be ignored.
|
| actions | object | Can be used to add actions to the card component. See macro options for actions. |
| caller | nunjucks-block |
Not strictly a parameter but a Nunjucks code convention. Using a call block enables you to call a macro with all the text inside the tag. This is helpful if you want to pass a lot of content into a macro. To use it, you will need to wrap the entire card component in a call block.
|
| classes | string | Classes to add to the card. |
| attributes | object | HTML attributes (for example data attributes) to add to the card. |
| Name | Type | Description |
|---|---|---|
| src | string | Required. The URL of the image in the card. |
| alt | string | The alternative text of the image in the card. |
| html | string |
HTML to use for the image content. If html is provided, the src and alt arguments will be ignored.
|
| Name | Type | Description |
|---|---|---|
| items | array | Array of actions as links for use in the card component. See macro options for actions items. |
| classes | string | Classes to add to the actions wrapper. |
| Name | Type | Description |
|---|---|---|
| href | string |
Required.
The value of the link's href attribute for an action item.
|
| text | string |
Required.
If html is set, this is not required. Text to use within each action item. If html is provided, the text option will be ignored.
|
| html | string |
Required.
If text is set, this is not required. HTML to use within each action item. If html is provided, the text option will be ignored.
|
|
visually |
string |
Actions rely on context from the surrounding content so may require additional accessible text. Text supplied to this option is appended to the end. Use html for more complicated scenarios.
|
| classes | string | Classes to add to the action item. |
| attributes | object | HTML attributes (for example data attributes) to add to the action item. |
Accessibility
Heading level and size
Use headings correctly to reflect the page structure. If you need to, change the default h2 heading.
Here's an example of replacing the default h2 heading with an h3.
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. Deprecated options are marked as "Deprecated".
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 | Description |
|---|---|---|
| id | string | The ID of the card. |
| heading | string |
Required.
Text to use within the heading of the card component. If headingHtml is provided, the heading argument will be ignored.
|
|
heading |
string |
Required.
HTML to use within the heading of the card component. If headingHtml is provided, the heading argument will be ignored.
|
|
heading |
string | Classes to add to the card heading. |
|
heading |
string |
Size of the heading – "xss", "xs", "s", "m", "l" or "xl".
|
|
heading |
integer |
Optional heading level for the card heading. Defaults to 2.
|
|
heading |
string |
Optional id attribute for the card heading.
|
|
heading |
string | Optional visually hidden prefix used before the heading. |
| href | string |
The value of the card link href attribute.
|
| clickable | boolean |
If set to true, then the whole card will become a clickable card variant.
|
| variant | string |
Optional variant of card – "feature", "primary", "secondary", "warning", "non-urgent", "urgent" or "emergency".
|
| type | string |
Deprecated in 10.4.0 Optional type of care card – "non-urgent", "urgent" or "emergency". Replaced by the variant option.
|
| feature | boolean |
Deprecated in 10.4.0 If set to true, then the card will become a feature card variant.
|
| primary | boolean |
Deprecated in 10.4.0 If set to true, the card will become a primary card variant (with chevron).
|
| secondary | boolean |
Deprecated in 10.4.0 If set to true, the card will become a secondary card variant.
|
| warning | boolean |
Deprecated in 10.4.0 If set to true, then the card will become a warning card variant used by the warning callout.
|
|
img |
string |
Deprecated in 10.3.0 The URL of the image in the card. Replaced by the image.src option.
|
|
img |
string |
Deprecated in 10.3.0 The alternative text of the image in the card. Replaced by the image.alt option.
|
| image | object | Can be used to add an image to the card component. See macro options for image. |
| description | string |
Text description within the card content. If descriptionHtml is provided, the description argument will be ignored.
|
|
description |
string |
HTML to use within the card content. If descriptionHtml is provided, the description argument will be ignored.
|
| actions | object | Can be used to add actions to the card component. See macro options for actions. |
| caller | nunjucks-block |
Not strictly a parameter but a Nunjucks code convention. Using a call block enables you to call a macro with all the text inside the tag. This is helpful if you want to pass a lot of content into a macro. To use it, you will need to wrap the entire card component in a call block.
|
| classes | string | Classes to add to the card. |
| attributes | object | HTML attributes (for example data attributes) to add to the card. |
| Name | Type | Description |
|---|---|---|
| src | string | Required. The URL of the image in the card. |
| alt | string | The alternative text of the image in the card. |
| html | string |
HTML to use for the image content. If html is provided, the src and alt arguments will be ignored.
|
| Name | Type | Description |
|---|---|---|
| items | array | Array of actions as links for use in the card component. See macro options for actions items. |
| classes | string | Classes to add to the actions wrapper. |
| Name | Type | Description |
|---|---|---|
| href | string |
Required.
The value of the link's href attribute for an action item.
|
| text | string |
Required.
If html is set, this is not required. Text to use within each action item. If html is provided, the text option will be ignored.
|
| html | string |
Required.
If text is set, this is not required. HTML to use within each action item. If html is provided, the text option will be ignored.
|
|
visually |
string |
Actions rely on context from the surrounding content so may require additional accessible text. Text supplied to this option is appended to the end. Use html for more complicated scenarios.
|
| classes | string | Classes to add to the action item. |
| attributes | object | HTML attributes (for example data attributes) to add to the action item. |
You can change the size of the heading using heading typography styles.
When using Nunjucks, you can set the size of card headings using the headingSize option, for example: headingSize: "s". You can use sizes xxs, xs, s, m, l, xl.
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. Deprecated options are marked as "Deprecated".
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 | Description |
|---|---|---|
| id | string | The ID of the card. |
| heading | string |
Required.
Text to use within the heading of the card component. If headingHtml is provided, the heading argument will be ignored.
|
|
heading |
string |
Required.
HTML to use within the heading of the card component. If headingHtml is provided, the heading argument will be ignored.
|
|
heading |
string | Classes to add to the card heading. |
|
heading |
string |
Size of the heading – "xss", "xs", "s", "m", "l" or "xl".
|
|
heading |
integer |
Optional heading level for the card heading. Defaults to 2.
|
|
heading |
string |
Optional id attribute for the card heading.
|
|
heading |
string | Optional visually hidden prefix used before the heading. |
| href | string |
The value of the card link href attribute.
|
| clickable | boolean |
If set to true, then the whole card will become a clickable card variant.
|
| variant | string |
Optional variant of card – "feature", "primary", "secondary", "warning", "non-urgent", "urgent" or "emergency".
|
| type | string |
Deprecated in 10.4.0 Optional type of care card – "non-urgent", "urgent" or "emergency". Replaced by the variant option.
|
| feature | boolean |
Deprecated in 10.4.0 If set to true, then the card will become a feature card variant.
|
| primary | boolean |
Deprecated in 10.4.0 If set to true, the card will become a primary card variant (with chevron).
|
| secondary | boolean |
Deprecated in 10.4.0 If set to true, the card will become a secondary card variant.
|
| warning | boolean |
Deprecated in 10.4.0 If set to true, then the card will become a warning card variant used by the warning callout.
|
|
img |
string |
Deprecated in 10.3.0 The URL of the image in the card. Replaced by the image.src option.
|
|
img |
string |
Deprecated in 10.3.0 The alternative text of the image in the card. Replaced by the image.alt option.
|
| image | object | Can be used to add an image to the card component. See macro options for image. |
| description | string |
Text description within the card content. If descriptionHtml is provided, the description argument will be ignored.
|
|
description |
string |
HTML to use within the card content. If descriptionHtml is provided, the description argument will be ignored.
|
| actions | object | Can be used to add actions to the card component. See macro options for actions. |
| caller | nunjucks-block |
Not strictly a parameter but a Nunjucks code convention. Using a call block enables you to call a macro with all the text inside the tag. This is helpful if you want to pass a lot of content into a macro. To use it, you will need to wrap the entire card component in a call block.
|
| classes | string | Classes to add to the card. |
| attributes | object | HTML attributes (for example data attributes) to add to the card. |
| Name | Type | Description |
|---|---|---|
| src | string | Required. The URL of the image in the card. |
| alt | string | The alternative text of the image in the card. |
| html | string |
HTML to use for the image content. If html is provided, the src and alt arguments will be ignored.
|
| Name | Type | Description |
|---|---|---|
| items | array | Array of actions as links for use in the card component. See macro options for actions items. |
| classes | string | Classes to add to the actions wrapper. |
| Name | Type | Description |
|---|---|---|
| href | string |
Required.
The value of the link's href attribute for an action item.
|
| text | string |
Required.
If html is set, this is not required. Text to use within each action item. If html is provided, the text option will be ignored.
|
| html | string |
Required.
If text is set, this is not required. HTML to use within each action item. If html is provided, the text option will be ignored.
|
|
visually |
string |
Actions rely on context from the surrounding content so may require additional accessible text. Text supplied to this option is appended to the end. Use html for more complicated scenarios.
|
| classes | string | Classes to add to the action item. |
| attributes | object | HTML attributes (for example data attributes) to add to the action item. |
Research
We have tested cards on the NHS website, summary care record and NHS login help centre. We found that they helped users:
- scan for relevant information
- decide where to go next
Help us improve this guidance
Share insights or feedback and take part in the discussion. We use GitHub as a collaboration space. All the information on it is open to the public.
Feed back or share insights on GitHubRead more about how to feed back or share insights.
If you have any questions, get in touch with the service manual team.
Updated: April 2026