NavToggle

OverviewExamplesPropertiesMethodsDependenciesUsageIntegration

Nav toggle is meant for hiding and showing the primary navigation. Used internally by `<nord-layout>` as the default contents of its `nav-toggle` slot. Can also be placed **anywhere inside `<nord-layout>`** (e.g. inside a `<nord-header>` next to the page title) — the layout listens for clicks on any descendant `<nord-nav-toggle>` and toggles the navigation accordingly. Outside of a `<nord-layout>` it renders as a presentational button with no behaviour. The two displayed icons can be customised via the `icon` and `icon-active` attributes. The first is shown in the resting state; the second replaces it on hover/focus (≥ 768px). Set `auto-hide` to have the toggle disappear automatically when the ancestor `<nord-layout>`'s nav is open (on wide viewports), mirroring the built-in fallback toggle's behaviour.

Loading...

Properties

PropertyAttribute Description TypeDefault
iconiconIcon shown in the resting state. Accepts any registered icon name. Defaults to `navigation-toggle`.string
iconActiveicon-activeIcon shown on hover/focus (≥ 768px), swapping in for `icon`. Defaults to `navigation-toggle-lock`.string
autoHideauto-hideWhen set, the toggle finds its ancestor `<nord-layout>` and hides itself on wide viewports while the layout's nav is open. Useful when placing the toggle outside the `nav-toggle` slot.booleanfalse

Methods

Method nameParameters Description
focus(options?: FocusOptions) => voidoptions: An object which controls aspects of the focusing process.Programmatically move focus to the component.
blur() => voidN/AProgrammatically remove focus from the component.
click() => voidN/AProgrammatically simulates a click on the component.

Usage

This section includes guidelines for designers and developers about the usage of this component in different contexts.

Do

  • Use a tooltip with the toggle that’s labelled as Toggle navigation.
  • We recommend setting a keyboard shortcut that toggles the navigation.

Don’t

Integration

For integration guidelines, please see Web Components documentation .

Was this page helpful?

Yes No

We use this feedback to improve our documentation.