Panel Nunjucks macro options
Use options to customise the appearance, content and behaviour of this component when using a macro, for example, changing the text.
Also see the guidance on the Panel component page, which shows these options in use within each example.
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 |
|---|---|---|
| title |
string |
Required.
If titleHtml is set, this is not required. Text to use within the panel. If titleHtml is provided, the titleText option will be ignored.
|
| title |
string |
Required.
If titleText is set, this is not required. HTML to use within the panel. If titleHtml is provided, the titleText option will be ignored.
|
| heading |
integer |
Heading level, from 1 to 6. Default is 1.
|
| text | string |
Required.
If html is set, this is not required. Text to use within the panel content. 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 the panel content. If html is provided, the text option will be ignored.
|
| caller | nunjucks-block |
Not strictly a parameter but 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 panel component in a call block.
|
| classes | string | Classes to add to the panel container. |
| attributes | object | HTML attributes (for example data attributes) to add to the panel container. |
| actions | object |
Can be used when creating an interruption panel which will add a button or link. Default is button unless you set href which will show the action as a link.
See macro options for actions.
|
| Name | Type | Description |
|---|---|---|
| items | array | The list of buttons or links to display at the end of an Interruption panel. See macro options for actions items. |
| classes | string |
The additional classes that you want to add to the govuk-panel__actions element that wraps the buttons or links.
|
| attributes | object |
The additional attributes that you want to add to the govuk-panel__actions element that wraps the buttons or links. For example, data attributes.
|
| Name | Type | Description |
|---|---|---|
| text | string | Required. The button or link text. |
| type | string |
The type of button – "button" or "submit". If href is provided, set type to "button" render a link styled as a button.
|
| href | string |
The href for a link. Set type to "button" and set href to render a link styled as a button.
|
| classes | string | The additional classes that you want to add to the button or link. |
| attributes | object | The additional attributes that you want to add to the button or link. For example, data attributes. |