Skip to main content
cngx-src documentation

CngxTocContract

Interface

projects/ui/toc/toc-token.ts

Referenced by#

Import#

import { CngxTocContract } from '@cngx/ui/toc'

Description#

Minimal contract a toc rail exposes to its collaborators (the opt-in CngxTocRouterSync fragment directive): the active-section signal it derives, the activation output it emits, and the imperative scrollTo it owns. Injected via CNGX_TOC + useExisting, never by injecting the concrete CngxToc class - that would create a cyclic type dependency and block the decompose brain/skin split.

Direction mirrors CNGX_SIDENAV, not CNGX_BREADCRUMB_ITEMS_SOURCE: the rail owns the state (activeId, scrollTo) and the collaborator consumes it, so the toc provides the token and the sync directive injects it.

Index#

Instance Properties#

activated#OutputRef
Readonly

Fires when a link is activated (click / Enter), carrying its item.

activeId#Signal
Readonly

The section currently most visible, or null before the spy resolves.

Methods#

scrollTo#void
scrollTo(id: string)

Scroll the section with this id into view and move focus to it.

@paramidstring