Skip to main content
Neural UIv2.0.0Documentation
View v1 GitHub

Nav

Build collapsible side navigation with grouped links, branding and a footer.

Category
Navigation
Import
@neural-ui/core/nav
Selector
neu-nav
import { NeuNavComponent } from '@neural-ui/core/nav';

Usage

Each NeuNavItem has id, label and an icon key. route uses Angular routing and href is an external destination. children creates expandable groups, active marks the current entry and badge/badgeTone communicate status. Icons resolve through the application provider; an empty key omits the graphic.

Examples

Try the interaction and open Code for the complete implementation.

Examples

collapsedChange: expanded

Try and configure

Change the options, try the result and see the template update. Open Code for the complete data model and implementation.

Try and configure

collapsedChange: expanded

Core options update this template. Item icons, badges and disabled destinations belong to the data model shown in Code.

template.html
<neu-nav
  [items]="items"
  ariaLabel="Example navigation"
  [collapsed]="collapsed()"
  [collapsible]="true"
  expandLabel="Expand navigation"
  collapseLabel="Collapse navigation"
  (collapsedChange)="collapsed.set($event)"
>
  <span neu-nav-brand class="menus-brand">
    <app-navigation-example-icon kind="home" size="24" />
    <span>Neural Studio</span>
  </span>
  <app-navigation-example-icon neu-nav-brand-icon kind="home" size="24" />
</neu-nav>

Data and content

Provide collapsed and accept collapsedChange for controlled rail width; omit collapsed for internal state. collapsible controls whether the toggle is present, not the applied state. Core owns local group disclosure and collapsed-mode flyouts. The application owns route/active data. Project brand icon, brand text and footer with their dedicated attributes. Nav has no itemClick Output.

Accessibility and keyboard

Translate expandLabel/collapseLabel and name the navigation. Use native links/buttons with Tab and Enter/Space. Groups expose aria-expanded and active destinations expose aria-current. Collapsed flyouts retain labelled controls and Escape focus restoration. Keep brand/footer controls meaningful in both expanded and collapsed layouts.

Key
Action
Tab Move through enabled navigation links and group buttons.
Enter Follow the focused link or activate the focused group button.
Space Activate the focused group button; links keep their native behaviour.
Escape Close an open collapsed flyout and restore focus.

API

Inputs and Outputs match the installed package. Named types link to definitions. Each available Template/projection has an executable example.

Inputs

Configure the component with [property]="value". Your application supplies these values; the component does not replace the state you pass in.

Name
Type
Default
Template binding
Description
ariaLabelstring'Main navigation'[ariaLabel]Accessible navigation/menu name. Use a label specific to this region.
collapsedboolean | undefinedundefined[collapsed]Applied collapsed state; undefined lets the component manage the state.
collapseLabelstring'Collapse navigation'[collapseLabel]Accessible label of the toggle in expanded mode.
collapsiblebooleantrue[collapsible]Shows/hides the collapse toggle without overriding collapsed.
expandLabelstring'Expand navigation'[expandLabel]Accessible label of the toggle in collapsed mode.
itemsNeuNavItem[][][items]Navigation data with id, label, icon and optional route/href, groups, active state and badges.

Outputs

Listen to an event with (event)="handler($event)". The table explains the data your handler receives and how to use it.

Name
Payload
Template binding
Description
collapsedChangeboolean(collapsedChange)="onCollapsedChange($event)"Proposes the next collapsed state; update collapsed when controlled.

Templates

ng-content projects content into the component. TemplateRef inputs receive a template; ng-template directives identify templates with a typed context. A directive shared by an entrypoint is not necessarily a slot of this component.

Name
Mechanism
Contract
[neu-nav-brand-icon]View example Content projection<ng-content select="[neu-nav-brand-icon]" />
[neu-nav-brand]View example Content projection<ng-content select="[neu-nav-brand]" />
[neu-nav-footer]View example Content projection<ng-content select="[neu-nav-footer]" />

Each example demonstrates a different template. Switch between Demo and Code to inspect its implementation, imports and state.

Brand icon

[neu-nav-brand-icon]

Brand icon

collapsedChange: collapsed

Brand text

[neu-nav-brand]

Brand text

collapsedChange: expanded

Public Types

Open a type to inspect its definition and interface fields.

Styles and tokens

Use supported public tokens for the component. Icon resolution and surrounding example layout belong to the application. Check both themes and narrow screens.

Specific tokens

Token
Purpose
State / variant
Default / source
Fallback
--neu-nav-toggle-bg Inherited theme value used by this component Field surface var(--neu-surface)Root declaration--neu-surface
--neu-nav-toggle-bg-hover Inherited theme value used by this component Field surface var(--neu-surface-2)Root declaration--neu-surface-2
--neu-nav-toggle-border Inherited theme value used by this component Field surface var(--neu-border)Root declaration--neu-border
--neu-nav-toggle-color Inherited theme value used by this component Field surface var(--neu-text-muted)Root declaration--neu-text-muted
--neu-nav-toggle-offset-top Inherited theme value used by this component Field surface 18pxRoot declarationNo token alias
--neu-nav-toggle-shadow Surface or overlay elevation Field surface 0 6px 14px color-mix(in srgb, var(--neu-text) 10%, transparent), inset 0 1px 0 color-mix(in srgb, var(--neu-surface) 82%, white)Root declaration--neu-text, --neu-surface
--neu-nav-toggle-size Inherited theme value used by this component Field surface 28pxRoot declarationNo token alias

Shared tokens used

Override these on a local wrapper to affect this example. An override on :root affects other components that use the same token.

Token
Purpose here
Other impact
Default / fallback
--neu-border Normal control and cell borders Shared by other Core consumers; scope the override. rgba(15, 23, 42, 0.08)
--neu-error-bg Background of invalid or danger states Shared by other Core consumers; scope the override. #fee2e2
--neu-error-text Error text and danger outline/ghost Button text in both themes Shared by other Core consumers; scope the override. #991b1b
--neu-focus-ring-strong Emphasized focus treatment Shared by other Core consumers; scope the override. 0 0 0 var(--neu-focus-ring-width) rgba(0, 122, 255, 0.35)
--neu-primary Brand color for active controls and emphasis Shared by other Core consumers; scope the override. #007aff
--neu-primary-50 Subtle brand surface for hover and focus states Shared by other Core consumers; scope the override. #eff6ff
--neu-primary-dark Dark brand shade; outline and ghost Button text in the light theme Shared by other Core consumers; scope the override. #005fcc
--neu-surface Main field, header or control surface Shared by other Core consumers; scope the override. #ffffff