Skip to main content
Horizontal navigation

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 Description
items array Required. Array of object navigation items, see items
selectedItem string URL string to highlight selected navigation item
ariaLabel string Aria label for navigation, defaults to 'Horizontal'
contained string Wraps the navigation in a container
containerClasses string Additional classes to add to the container
attributes object HTML Attributes (data attributes) to add to the container

Options for items array object

Name Type Description
text string Required. Value for text of the naivigation link
href string Required. Value for the href of the navigation link
id string Value for the id of the navigation link