npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ng-hub-ui-nav

v22.3.0

Published

A flexible, accessible, and customizable navigation component for Angular 21, part of the ng-hub-ui family.

Readme

ng-hub-ui-nav

Español | English

npm version license

A flexible, accessible, and highly customizable navigation component for Angular 21+. It supports horizontal menus, vertical sidebars, mobile collapse modes, stacked drill-down panels, projected start/end slots, and scroll-spy integration.

[!IMPORTANT] Version 21.1.1 targets Angular 21 and follows the signal-first architecture used across ng-hub-ui.

Documentation and Live Examples

This package is part of Hub UI, a collection of Angular component libraries for standalone apps.

  • Docs: https://hubui.dev/nav/overview/
  • Live examples: https://hubui.dev/nav/examples/
  • Hub UI: https://hubui.dev/

🧩 Library Family ng-hub-ui

This library is part of the ng-hub-ui ecosystem:

Table of Contents

Features

  • Horizontal and vertical navigation layouts.
  • Responsive collapse modes: offcanvas, dropdown, and fullscreen.
  • Vertical child expansion modes: accordion, flyout, and panel.
  • Stacked panel drill-down navigation with configurable visible panel count.
  • Projected hubNavStart and hubNavEnd slots.
  • Custom item rendering with hubNavItemTemplate.
  • Router-aware active states with fragment and query param support.
  • Scroll-spy helpers for documentation pages and one-page layouts.
  • Sticky vertical navigation support.
  • Tooltip on truncated labels — long item labels are clipped with an ellipsis (the standard sidebar behaviour) and reveal their full text on hover, automatically and only when truncated (via ng-hub-ui-utils' [hubOverflowTooltip]). The tooltip is agnostic — it defaults to the hub-ui tooltip but is swappable with provideHubTooltip(...). Requires ng-hub-ui-utils >= 22.6.0 and the tooltip styles (@use 'ng-hub-ui-utils/styles/tooltip';). Tip: control the sidebar width with --hub-nav-panel-width.
  • Semantic variant accent system (primary / success / danger / warning / info, plus any custom accent) recolouring the hover/active affordances — mirrors <hub-panels>.
  • Full CSS variable theming via --hub-nav-* tokens.

Installation

npm install ng-hub-ui-nav

Quick Start

import { Component } from '@angular/core';
import { HubNavComponent, HubNavItem } from 'ng-hub-ui-nav';

@Component({
	standalone: true,
	imports: [HubNavComponent],
	template: `
		<hub-nav
			[items]="items"
			[config]="{
				orientation: 'horizontal',
				dropdownTrigger: 'click'
			}"
		/>
	`
})
export class ExampleComponent {
	readonly items: HubNavItem[] = [
		{ id: 'home', label: 'Home', type: 'link', route: '/' },
		{
			id: 'components',
			label: 'Components',
			type: 'dropdown',
			children: [
				{ id: 'accordion', label: 'Accordion', type: 'link', route: '/accordion' },
				{ id: 'calendar', label: 'Calendar', type: 'link', route: '/calendar' }
			]
		}
	];
}

Examples

Vertical Sidebar with Panels

<hub-nav
	[items]="items"
	[config]="{
		orientation: 'vertical',
		verticalExpandMode: 'panel',
		panelMaxVisible: 2,
		panelWidth: '18rem',
		position: 'sticky',
		stickyTop: '1rem'
	}"
/>

Start and End Slots

<hub-nav [items]="items" [config]="{ orientation: 'horizontal' }">
	<ng-template hubNavStart let-collapsed="collapsed">
		<strong>My App</strong>
	</ng-template>

	<ng-template hubNavEnd>
		<button type="button">Profile</button>
	</ng-template>
</hub-nav>

Scroll Spy

<section
	hubNavScrollSpy
	(activeSectionChange)="activeSection = $event"
>
	<section id="overview" hubNavScrollSpySection>...</section>
	<section id="api" hubNavScrollSpySection>...</section>
</section>

API Reference

HubNavComponent

Inputs

| Input | Type | Default | Description | |---|---|---|---| | items | HubNavItem[] | required | Navigation tree to render. | | config | Partial<HubNavConfig> | {} | Per-instance config merged with global defaults. | | navClass | string | '' | Additional class applied to the internal <nav>. | | itemTemplate | TemplateRef<unknown> \| null | null | Optional custom item template. | | autoOpenFromRoute | boolean | false | Opens matching dropdowns/panels from the current route. | | variant | 'primary' \| 'success' \| 'danger' \| 'warning' \| 'info' \| string | 'primary' | Semantic accent for the hover/active affordances. Built-in values render with the design-system tints; any custom string resolves through --hub-sys-color-<variant>. |

Outputs

| Output | Type | Description | |---|---|---| | itemClick | OutputEmitterRef<HubNavItem> | Emitted when a link item is activated. | | dropdownOpen | OutputEmitterRef<HubNavItem> | Emitted when a dropdown opens. | | dropdownClose | OutputEmitterRef<HubNavItem> | Emitted when a dropdown closes. | | mobileToggle | OutputEmitterRef<boolean> | Emitted when the responsive mobile panel opens or closes. | | panelChange | OutputEmitterRef<HubNavPanelEvent> | Emitted when a panel opens, closes, drills down, or drills back. |

HubNavConfig

interface HubNavConfig {
	orientation: 'horizontal' | 'vertical';
	verticalExpandMode: 'accordion' | 'flyout' | 'panel';
	dropdownTrigger: 'hover' | 'click' | 'both';
	position: 'static' | 'sticky' | 'fixed';
	stickyTop: string;
	collapseMode: 'offcanvas' | 'dropdown' | 'fullscreen';
	collapseBreakpoint: number;
	offcanvasPosition: 'start' | 'end' | 'top' | 'bottom';
	ariaLabel: string;
	panelMaxVisible: number;
	sidebarSide: 'left' | 'right';
	panelWidth: string;
}

HubNavItem

interface HubNavItem {
	id: string;
	label: string;
	type: 'link' | 'dropdown' | 'header' | 'separator' | 'custom';
	icon?: string;
	route?: string | string[];
	queryParams?: Record<string, string>;
	fragment?: string;
	routerLinkActiveOptions?: { exact: boolean };
	children?: HubNavItem[];
	badge?: string;
	badgeClass?: string;
	disabled?: boolean;
	cssClass?: string;
	data?: unknown;
	expandMode?: 'accordion' | 'flyout' | 'panel';
}

Directives

  • hubNavStart: projects content into the start slot.
  • hubNavEnd: projects content into the end slot.
  • hubNavItemTemplate: overrides item rendering.
  • hubNavScrollSpy: tracks visible sections in a scroll container.
  • hubNavScrollSpySection: marks a section as spy-trackable.

Styling

The component exposes a complete set of --hub-nav-* tokens. See the full reference in:

Recolour the whole nav from a single accent

The hover/active affordances and the nav surface all derive from one accent hook. Set it (or use the variant input) to re-theme the entire nav:

.my-sidebar {
	--hub-nav-panel-width: 18rem;
	/* Single recolour hook — the tinted active background, accent text, hover
	   tint, indicator bar, and surface wash all follow this one accent. */
	--hub-nav-accent: var(--hub-sys-color-success);
	--hub-nav-dropdown-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.16);
}

Restore the legacy solid-fill look

The default active item is now a soft accent tint + accent text. To restore the previous solid accent fill + white text (the pre-22.1.0 look), override these tokens explicitly:

.my-sidebar {
	--hub-nav-item-active-bg: #0d6efd;
	--hub-nav-item-active-color: #ffffff;
	--hub-nav-item-hover-bg: rgba(0, 0, 0, 0.04);
	--hub-nav-bg: #ffffff;
}

Changelog

See the full release history in CHANGELOG.md.

If you are upgrading across versions, also review BREAKING_CHANGES.md.

Contribution

Issues, discussions, and pull requests are welcome.

If you want to contribute:

  1. Fork the repository.
  2. Create a feature branch.
  3. Keep API changes documented in the README and changelog.
  4. Open a pull request with a clear description of the change.

Support

If this library helps your projects, you can support its maintenance here:

Contributors

Created and maintained by Carlos Morcillo.

License

This project is licensed under the MIT License. See the LICENSE file for details.