<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 | Text to use within the heading of the card component. If `headingHtml` is provided, the `heading` argument will be ignored. |
headingHtml | string | true | HTML to use within the heading of the card component. If `headingHtml` is provided, the `heading` argument will be ignored. |
headingClasses | string | false | Classes to add to the card heading. |
headingLevel | integer | false | Optional heading level for the card heading. Default: 2 |
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. |
feature | boolean | false | If set to true, then the Card will become a feature 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 | Text description within the card content. If `descriptionHtml` is provided, the `description` argument will be ignored. |
descriptionHtml | string | false | HTML to use within the card content. If `descriptionHtml` is provided, the `description` argument will be ignored. |
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>