Navigation

Create interactive navigation menus anywhere in your help center.

The Navigation extension allows you to create dynamic, interactive navigation elements anywhere in your help center quickly and easily without being limited by Zendesk’s native page template and objects.

Category lists

Categories presented in collapsible tabs
View code
2d85e44f48417cb62bb4b0f1f13a8bdb590e18c3ea499389b2b5bc24834238d83da61781c84e7e3b678d8816717b434e03ad8243e29e7055371ba55f834627eae2c45fa71febe602d489211ad4355b318448adfbcaa139aa52cd3b562a2372f55705ce3ffa9885990a8f01758f717a5d1100a2213f21af73308935746669299ea84a1a2766109bf4f05a92524dc9f8da29066d8bf93241adc6fd934dd02bcb86f9338c6cb86e79efb62263c2e90e82995cd22da2e1508876fc00280a8901879eddec18e54de5201b2d1787dbb745620fe6dab9e249310d8c9ca36d21bce0c6300d3227318cbe53ea3a35dfb125dc061758c9c959def6749a1fe998036952e0ea06b72cb15cad8aaae1bd4fb3792b03b415feb618450bb62bab5b4eb90061cdff78dba258d93172df5dbd5623c640e85f448a39fb9aa94f92c8ecc94bcaa5b079d885873a6649e3d7c638a1637b90d91e5715300d6e76cfae166c1a41c80cfd865c940935ead7bc9e456c038c43413996e1564fc66322a22dc78ba357a96635628f72e394705c9f7c4d066571639053765881cd99cc2f468935919fe79fa001c084e6dd8e9e71d37a41571e41e6c43add31b6d75aa5d44ab08e99482c81813130737446b47cf1871999fac12be943ee0cc17df1acc3a415322368e7a116d654bf409207a4adccc2ea2602cf7094355b50922475410849c6a94c69a0b8b607f3f50eedea0df1718c041de1312ae6d358d1cd693e6729cbe7ca4a5c903c431f184a776392e26bb43952c552d3d14012626027340807da8f137068218af26e5d65cc0b8e6cf64353093475de1b8ffc9e543bd51a44988c89f01436a8bc94ae3d7961776b92571e1c70969bb0a590a371ae9fe17d297a9b8a81527faa2f80845cd7e35508797d7156afb203f895482c3832cf0de4c2dbe5e5e5158032c126026b42b6e71a9c3271de4df77fa549a81ba95f2196799b69f07b85fc3d32588fd4a1a82e246e8f4b5e5c5b089ac684acaef764d5ef86c740de524e8b79cb00c7a34896262fb4e6df689350645e9dc9d694efe4e19f49294c1d75389065288074268639eadb70699ec66059da71e164778cab8b1662b52926414126fb73d892fd6e8f163d8840d1e8b9fb15424a0703139bbde41a0ff344dec1ce697b7593151b03ab22450980c39c4c935d09222503a902369836c51f50825ddbc33cb55c0a7188c51d227c62c36b9b25c08151e46d6fe7352b129ad9dbb8137b731430a490848475e7a45fa16d8370f27b9f72808028a50ed6bbcc5f98e98fa5276e993c0e005fbf1d107032dc3f8450f86fd19d59e3bab1b5b54e70626cfd034975e039d3ba6a5a7fa6f47446a180687c6e7f0beb953bb5531b1cc31765147421579f315f4641c074dd4b3be8836c8badd50c68cda6e1b6c9917da560929f002c6b8cf01028e11c7d9002dce74ff0707778a7e7bfd70d68fe5486ab70fcc167dc7baa282e51096fb240c1858e89bcfb2eb902ae2de9c31858a53f06fe8eacdb16c3c471b58e157cb2e722fe66a0b9b8689446cd10cbb75f3f0790e5d11c6a1af5679ae171bdf815bf6db08960c543b9241713ee33a95f473ed50ff937b7809ed43c26b4d607f95499b80214020d2c1b2506559db186cb204336e4c135d63b2b66dfcaa4abd6d412684f3b9059adac55bada899c35efb4c3c7c3ce1be08fe4817faab178ea4c07800d8985141f6b709698a5d1ad5ab30c84fe83a4f4a32d95bd6899d2eb8a5af4a53cdbeda7f95034bdb69f2643ded5d565cb05900783769d531e71ac0e9586138f51e69c85a4348eb3b85361326303689fc36225381da7902896bab6babc8be7c9ef8472bf7ea7287cddb44b3edf8a32758bfd1e5ef4bd8065f7a0b1a8278ad0a29165a2cc0e2176a1b1abfee8f785f766b9cf06b2f25afdbb751e5faea4226d5f32f0

Section lists

Sections presented in groups

Article lists

Articles in a two-column list
Navigation menu containing sections and articles

Additional examples can be seen throughout our themes and in our Pattern Library.

The Navigation extension is bundled into all of our themes by default, so you can start using it straight away. You can find the source code for the extension within the extension-navigation.(min.)js file in the theme’s Assets folder.

Our themes allow you to add pre-built navigation menus on the Category, Section and Article pages using theme settings.

  1. In Zendesk Guide, click the Customize design icon (Customize icon) in the sidebar.

  2. Click Customize on the theme you want to edit.

  3. Expand the Category page elements, Section page elements or Article page elements sections and select a navigation style from the sidebar navigation setting.

Each setting includes a Custom template option which, when selected, allows you to use one of the many navigation patterns from our library.

Use data-element="navigation" on an element to create a dynamic navigation menu.

<div data-element="navigation" data-template="my-custom-template"></div>

<template id="tmpl-my-custom-template">
  ...
</template>

If data attributes are used you will need to ensure that the allow unsafe HTML setting is enabled within Zendesk Guide.

The Navigation extension can be initialized using JavaScript:

<div id="navigation-element">...</div>

<template id="tmpl-my-custom-template">
  ...
</template>

<script type="text/javascript">
  document.addEventListener('DOMContentLoaded', function() {
    var navigationElement = document.getElementById('navigation-element');
    if (!navigationElement) return;

    new Navigation(navigationElement, {
      template: 'my-custom-template',
      // Other options go here
    });
  });
</script>

Custom micro-templates

When using a custom micro-template, each object has an additional property (isActive) which specifies whether it’s active (meaning it, or one of its child or descendant objects, is being viewed).

<ul class="list-unstyled">
  <% categories.forEach(function(category) { %>
    <li>
      <a class="<% if (category.isActive) { %> font-bold<% } %>" href="<%= category.html_url %>">
        <%= category.name %>
      </a>
    </li>
  <% }) %>
</ul>

You can also access the IDs of the active category, section or article (if any) using activeCategoryId, activeSectionId and activeArticleId:

<ul class="list-unstyled">
  <% sections.forEach(function(section) { %>
    <li>
      <a class="<% if (section.id === activeSectionId) { %> font-bold<% } %>" href="<%= section.html_url %>">
        <%= section.name %>
      </a>
    </li>
  <% }) %>
</ul>

This is useful if you’re creating navigation menus with nested subsections, where two or more sections may have an isActive value of true, as activeSectionId represents the section actually being viewed (if any).

Additional custom data can be supplied to the template using the templateData option described below.

<nav id="navigation"></nav>

<script type="text/javascript">
  document.addEventListener('DOMContentLoaded', () => {
    new Navigation(document.getElementById('navigation'), {
      templateData: {
        foo: 'bar'
      }
    });
  });
</script>

Which would allow the value of foo to be accessed in a template using <%= foo %>.

Options

Options can be passed via data attributes or JavaScript.

For data attributes, append the option name to data- and use kebab case instead of camel case.

Name Type Default Description
collection object {} An object containing an array of objects representing categories, sections, articles, topics and/or posts. If the collection is not provided, the extension will fetch the objects specified in the option below from the Zendesk REST API.
objects array [
 'categories',
 'sections',
 'articles'
]
The list of object types to fetch from the REST API and make available to the template.
properties array Object properties The list of object properties from the REST API response to pass to the template.
categoryId string
number
null
null Only return objects from a specific category.
sectionId string
number
null
null Only return objects from a specific section.
topicId string
number
null
null Only return objects from a specific topic.
labels array [] Only return articles with specific labels.
filter object {} An object containing references to custom filtering functions for each object type, where the key is the type of object (e.g., 'categories'). The default filtering functions filter out draft articles.
sort object {} An object containing references to custom sorting functions for each object type, where the key is the type of object (e.g., 'categories').
sortOrder string 'asc' The sort order to use for each object collection.
template string
null
null The name of the template to use.
templateData object {} Additional data to expose to the template.

The collection object containing categories, sections, article, topics and/or posts is sorted and organized such that parent objects have access to their children.

<% categories.forEach(function(category) { %>
  <% category.sections.forEach(function(section) { %> // This is a child section
     ...
     <% section.sections.forEach(function(subsection) { %> // This is a subsection
       ...
    <% }) %>
  <% }) %>
<% }) %>

Object properties

The following object properties are passed to the template by default:

Name Description
id The ID of the object.
title The title of the object (articles and posts).
name The title of the object (categories, sections and topics).
description The description of the object categories, section and topics).
html_url The URL of the object.
position The position of the object (categories, sections, articles and topics).
promoted Whether or not the object is promoted (articles only).
pinned Whether or not the object is pinned (posts only).
draft Whether or not the object is a draft (articles only).
section_id The ID of the parent section (articles only).
parent_section_id The ID of the parent section (sections only).
category_id The ID of the parent or ancestor category (sections only).
topic_id The ID of the parent topic (posts only).
created_at The date and time that the object was created.

Events

Class Properties
navigation:render Fires when the navigation menu has been rendered.

Related extensions

Animations and transitions Free

Animations and transitions

Add engaging animation and transition effects to elements.

Carousels Free

Carousels

Present content in well-defined and easy to follow steps.

Content blocks and icons Free

Content blocks and icons

Display icons against categories, sections and articles.