Skip to main content
cngx-src documentation

CngxTabIconContext

Interface

projects/common/tabs/slots/tab-icon.directive.ts

Referenced by#

Import#

import { CngxTabIconContext } from '@cngx/common/tabs'

Description#

Context for the *cngxTabIcon template.
Rendered once per tab in the header, ahead of the label.
Carries the tab handle plus the two per-tab signals a consumer icon usually keys off - whether the tab is the active one and its positional index.

Richer than CngxTabErrorBadgeContext (which only needs tab) because an icon commonly swaps glyph on the active tab.

Index#

Instance Properties#

active#boolean
Readonly

Whether this tab is the currently active one.

index#number
Readonly

Zero-based position of the tab in the strip.

Readonly

The tab handle carrying id / label / disabled / aggregator signals.

CngxTabIcon

The slot paints a decorative icon ahead of the tab label. The label carries the accessible name, so the icon stays presentational.

  • The label is the accessible name, not the icon. The tab's name comes from its label and the verbose aria-label; the icon adds nothing to it. An icon-only layout (iconLayout="only") still keeps the label in the DOM for SR.
  • Do not encode state in the icon alone. Swapping the glyph on the active tab is fine as reinforcement, but selection is already conveyed by aria-selected - never let the icon be the only signal.
  • Keep the template decorative. Mark purely decorative icons aria-hidden; no interactive elements inside the header button.