Radical Design Course by Jack McDade

From the creator of Statamic

Learn how to make your websites standout and be remembered.

Taking your approach on designing things actually makes it fun, more natural, and overall easier.

— Dominik, Developer

Navs Fieldtype

Allows you to choose from one or more navigations.

Navs Fieldtype UI
The Navs Fieldtype in action!

Overview

Use this fieldtype to create a one-way relationship with one or more navigations in your site. It's a simple-little-helper type of thing.

Data Structure

The Navs fieldtype stores the handle of a single navigation as a string, or an array of handles if max_items is greater than 1.

navigations:
- main_nav
- footer

Templating

Loop through the structures to access their handles and pass them to a Nav tag.

{{ structures }}
<ul>
{{ nav :handle="handle" }}
<li><a href="{{ url }}">{{ title }}</a></li>
{{ /nav }}
</ul>
{{ /structures }}
<ul>
<li><a href="/look-at-this">Look at This!</a></li>
<li><a href="/look-at-that">Wait, Look at That!</a></li>
</ul>

Options

max_items

integer

The maximum number of items that may be selected. Setting this to 1 will change the UI to a dropdown.

mode

string

Set the UI style for this field. Can be one of 'default' (Stack Selector), 'select' (Select Dropdown) or 'typeahead' (Typeahead Field).

structure_types

array

Configure which types of structures you want to be selectable. Options are collection or navigation.

Docs feedback

Submit improvements, related content, or suggestions through Github.

Betterify this page →
Hello there! Are you looking for the Statamic v2 documentation?