Category dropdown

Display all categories within a menu in the page header.

Category dropdowns appear in the page header, providing access to all categories (and optionally sections) throughout the help center. They are fully responsive, meaning that they’ll look create on desktop and mobile devices.

Like other navigation elements in our themes, the list of categories is dynamically generated based on the content you’ve created in Zendesk Guide and will automatically reflect changes that you and other help center managers make.

Single category dropdown menu
View code
{{~#is settings.category_dropdown_style 'dropdown'}}
  <template id="tmpl-category-dropdown">
    <div class="relative h-full" x-data="Widgets.dropdown" @click.away="close">
      <button class="nav-link not-a-button{{#isnt settings.nav_style 'slide-in'}} w-full{{/isnt}}" aria-haspopup="true" :aria-expanded="isExpanded" x-ref="toggle">
        {{t 'categories'}}
        <svg class="svg-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" aria-hidden="true" :class="{ 'rotate-180': isExpanded }">
          <use xlink:href="#icon-chevron-down" />
        </svg>
      </button>
      <div class="z-dropdown mt-2 bg-white {{settings.nav_breakpoint}}:absolute {{settings.nav_breakpoint}}:border {{settings.nav_breakpoint}}:border-radius {{settings.nav_breakpoint}}:shadow-md {{settings.nav_breakpoint}}:min-w-dropdown" x-ref="menu" x-cloak x-show="isExpanded" :aria-expanded="isExpanded">
        <div class="py-2 {{settings.nav_breakpoint}}:font-size-sm {{settings.nav_breakpoint}}:text-left" x-data="Widgets.categories" x-init="getCategories">
          <template x-for="category in categories">
            <a class="dropdown-item" :href="category.html_url" x-text="category.name"></a>
          </template>
        </div>
      </div>
    </div>
  </template>
{{/is~}}

The default layout is a single category dropdown, but multiple category dropdowns displaying child sections can be easily added.

Multiple category dropdown menus
View code
<div class="flex" data-element="navigation" data-template="multiple-category-dropdowns"></div>

<template id="multiple-category-dropdowns">
  <% categories.forEach(function(category) { %>
    <% if (category.sections.length) { %>
      <div class="relative h-full" x-data="Widgets.dropdown" @click.away="close">
        <button class="nav-link not-a-button{{#isnt settings.nav_style 'slide-in'}} w-full{{/isnt}}" aria-haspopup="true" :aria-expanded="isExpanded" x-ref="toggle">
          <%= category.name %>
          <svg class="svg-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" aria-hidden="true" :class="{ 'rotate-180': isExpanded }">
            <use xlink:href="#icon-chevron-down" />
          </svg>
        </button>
        <div class="z-dropdown mt-2 bg-white {{settings.nav_breakpoint}}:absolute {{settings.nav_breakpoint}}:border {{settings.nav_breakpoint}}:border-radius {{settings.nav_breakpoint}}:shadow-md {{settings.nav_breakpoint}}:min-w-dropdown" x-ref="menu" x-cloak x-show="isExpanded" :aria-expanded="isExpanded">
          <div class="py-2 {{settings.nav_breakpoint}}:font-size-sm {{settings.nav_breakpoint}}:text-left">
            <% category.sections.forEach(function(section) { %>
              <a class="dropdown-item" href="<%= section.html_url %>">
                <%= section.name %>
              </a>
            <% }); %>
          </div>
        </div>
      </div>
    <% } %>
  <% }); %>
</template>

Because the extension build upon our powerful micro-templating system, you can completely change the look-and-feel and functionality of the dropdown menus. You can even control which pages they appear on with a few tweaks to the template!

This extension is bundled into all of our themes by default, so you can start using it straight away. It builds upon our powerful micro-templating system and gives you full control over how the search terms look and behave.

Our themes allow you to add a category list in a dropdown menu to the page header 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 Header elements section select a style from the Category list style setting dropdown list.

If you’d like to display a category dropdown outside of the page header, you can copy-and-paste the following category dropdown hook into your desired position:

{{#isnt settings.category_dropdown_style 'none'}}
  <div data-element="template" data-template="category-dropdown"></div>
{{/isnt}}

Our Navigation extension allows you to create category lists and navigation structures if you’re looking to display multiple category dropdowns or all categories and sections in a more general layout. To achieve this, replace the default category dropdown hook in the header.hbs template:

{{~#isnt settings.category_dropdown_style 'none'}}
  <div data-element="template" data-template="category-dropdown"></div>
{{/isnt~}}

With a Navigation extension hook and template:

{{~#isnt settings.category_dropdown_style 'none'}}
  <div class="flex" data-element="navigation" data-template="multiple-category-dropdowns"></div>
  <template id="tmpl-multiple-category-dropdowns">
  ...
  </template>
{{/isnt~}}

Custom micro-templates

Each theme comes with a number of built-in styles that you can choose from using the Popular keywords style theme setting, but you can add additional styles to your theme by:

  1. Editing the micro-template of your chosen style on the footer.hbs template.
  2. Copying a style across from another theme if you purchased our Complete Package.
  3. Copying a style from our Pattern Library.

All popular search term micro-templates use the same keyword list defined in theme settings but can differ significantly in terms of their look-and-feel and behavior.

Related extensions

Article navigation Free

Article navigation

Display links to next and previous articles.

Collapse Free

Collapse

Create versatile collapsible content areas anywhere in your help center.

Featured articles Free

Featured articles

Display a list of articles with one or more labels.