<ul class="nhsuk-grid-row nhsuk-card-group">
<li class="nhsuk-grid-column-two-thirds nhsuk-card-group__item">
<div class="nhsuk-card nhsuk-card--clickable">
<div class="nhsuk-card__content nhsuk-card__content--primary">
<h2 class="nhsuk-card__heading nhsuk-heading-m"> <a class="nhsuk-card__link" href="#">Introduction to care and support</a> </h2>
<p class="nhsuk-card__description">A quick guide for people who have care and support needs and their carers</p> <svg class="nhsuk-icon" xmlns="http://www.w3.org/2000/svg" width="27" height="27" aria-hidden="true" focusable="false">
<circle cx="13.333" cy="13.333" r="13.333" fill="" />
<g data-name="Group 1" fill="none" stroke="#fff" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2.667">
<path d="M15.438 13l-3.771 3.771" />
<path data-name="Path" d="M11.667 9.229L15.438 13" />
</g>
</svg>
</div>
</div>
</li>
</ul>
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 | true |
headingHtml is provided, the heading argument will be ignored. |
Text to use within the heading of the card component. If
headingHtml | string | true |
headingHtml is provided, the heading argument will be ignored. |
HTML to use within the heading of the card component. If
headingClasses | string | false | Classes to add to the card heading. |
headingLevel | integer | false |
2 . |
Optional heading level for the card heading. Defaults to
href | string | false | The value of the card link href attribute. |
clickable | boolean | false | If set to true, then the whole card will become a clickable card variant. |
type | string | false |
"non-urgent" , "urgent" or "emergency" . |
Care card variant type –
feature | boolean | false | If set to true, then the card will become a feature card variant. |
primary | boolean | false | If set to true, the card will become a primary card variant (with chevron). |
secondary | boolean | false | If set to true, the card will become a secondary card variant. |
topTask | boolean | false | If set to true, the card will become a top task card variant. |
imgURL | string | false | The URL of the image in the card. |
imgALT | string | false | The alternative text of the image in the card. |
description | string | false |
descriptionHtml is provided, the description argument will be ignored. |
Text description within the card content. If
descriptionHtml | string | false |
descriptionHtml is provided, the description argument will be ignored. |
HTML to use within the card content. If
caller | nunjucks-block | false |
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. |
Not strictly a parameter but a Nunjucks code convention. Using a
classes | string | false | Classes to add to the card. |
attributes | object | false | HTML attributes (for example data attributes) to add to the card. |
{% from 'card/macro.njk' import card %}
<ul class="nhsuk-grid-row nhsuk-card-group">
<li class="nhsuk-grid-column-two-thirds nhsuk-card-group__item">
{{ card({
href: "#",
primary: "true",
clickable: "true",
heading: "Introduction to care and support",
headingClasses: "nhsuk-heading-m",
description: "A quick guide for people who have care and support needs and their carers"
}) }}
</li>
</ul>