Skip to main content
cngx-src documentation

CngxDotStepper

ComponentPrimaryOnPushNo encapsulationv0.1.0WCAG AA

projects/ui/stepper/dot-stepper.component.ts

Import#

import { CngxDotStepper } from '@cngx/ui/stepper'

Description#

Dot stepper variant. Mobile-first sequential-flow indicator. Renders one labelled <span role="img"> per step (a name-permitting role, so each dot announces "Step N of M: label") inside a <div role="group" aria-roledescription="Step indicator">. The active dot carries aria-current="step" per the W3C APG step-indicator pattern (NOT role="tablist" / role="tab" - those are reserved for parallel content panels, not sequential flow).

Tap-to-select is intentionally NOT wired on individual dots: under the APG pattern each dot is a label, not a button, and attaching (click) to role="img" conflates two ARIA contracts. Navigation is offered uniformly via three modalities owned by the host element: arrow / Home / End keys, the composed CngxStepperSwipeNav dot-row gesture, and the two-way [(activeStepIndex)] binding for external buttons. Consumers wanting per-dot tap-to-jump compose the parent <cngx-stepper> (whose mobile-collapse dots branch renders each dot as a <button>).

Theming flows through new --cngx-dot-step-* custom properties whose defaults cascade through var(--cngx-step-active-fill, ...), so the Phase A active-fill chain reaches the dot variant without duplication.

https://cngxjs.github.io/cngx/examples/#/ui/stepper/dot-stepper/mobile-carousel

Metadata#

Host#

Dependencies#

CNGX_STEPPER_HOSTinject()presenter
CngxStepperSwipeNavinject()hostswipeNav

Mobile-swipe routing surface composed via hostDirectives.

Relationships

Index#

Inputs#

ariaLabel#string | undefined
input()
default undefined, { alias: 'aria-label' }
ariaLabelledBy#string | undefined
input()
default undefined, { alias: 'aria-labelledby' }

Instance Properties#

config#unknown
ProtectedReadonly
injectStepperConfig()
errorGlyph#unknown
ProtectedReadonly

Default error glyph for the aggregate error line.

CNGX_STEPPER_GLYPHS.errorBadge
i18n#unknown
ProtectedReadonly
injectStepperI18n()
resolvedDotTemplate#unknown
ProtectedReadonly

Resolved dot-body template cascade: per-instance *cngxDotStepperDot directive > CNGX_STEPPER_CONFIG.templates.dotStepperDot > null (built-in empty body). Pillar 1 - resolution is a computed, not manual sync.

computed<TemplateRef<CngxDotStepperDotContext> | null>(
  () => this.dotSlot()?.templateRef ?? this.config.templates?.dotStepperDot ?? null,
)
stateView#unknown
ProtectedReadonly

Shared per-step/aggregate state derivations - the single error source.

createStepperStateView({
  presenter: this.presenter,
  stepsOnly: this.stepNodes,
})
stepNodes#Signal
ProtectedReadonly
this.presenter.stepsOnly

Methods#

ariaLabelFor#string
Protected
ariaLabelFor(node: CngxStepNode, index: number)
@paramnodeCngxStepNode
@paramindexnumber
Protected
dotContextFor(node: CngxStepNode, index: number)

Build the slot context for *cngxDotStepperDot.

@paramnodeCngxStepNode
@paramindexnumber
dotState#string
Protected
dotState(node: CngxStepNode)

Resolved data-state for the dot: 'error' whenever the unified error view fires (covers commit rejection and the error aggregator, not just a literal state === 'error'), otherwise the raw step status.

@paramnodeCngxStepNode
handleKeyDown#void
Protected
handleKeyDown(event: KeyboardEvent)
@parameventKeyboardEvent
isActive#boolean
Protected
isActive(node: CngxStepNode, index: number)
@paramnodeCngxStepNode
@paramindexnumber
isCompleted#boolean
Protected
isCompleted(index: number)
@paramindexnumber

HostBindings#

BindingExpression
[attr.aria-roledescription]i18n.stepIndicatorRoleDescription
[attr.aria-label]ariaLabel()
[attr.aria-labelledby]ariaLabelledBy()
[attr.aria-invalid]stateView.hasAnyError() ? "true" : null

HostListeners#

EventHandler
(keydown)keydown()

Structural and thematic skin for <cngx-dot-stepper>.
Theme tokens cascade through var(--cngx-step-active-fill, ...) so the active-fill chain flows in without duplication.

Active dot uses --cngx-dot-step-active-fill; completed dots use:

  • --cngx-dot-step-completed-fill; upcoming dots use
  • --cngx-dot-step-upcoming-bg. Material consumers see
  • --mat-sys-primary via the stepper-theme extension.

Index#

--cngx-dot-step-size#*
Default value 0.625rem
--cngx-dot-step-gap#*
Default value 0.5rem
--cngx-dot-step-active-fill#*
Default value var(--cngx-step-active-fill, oklch(0.66 0.19 50))
--cngx-dot-step-completed-fill#*
Default value var(--cngx-step-completed-color, var(--cngx-color-success, oklch(0.5 0.15 145)))
--cngx-dot-step-upcoming-bg#*
Default value var(--cngx-step-indicator-bg, color-mix(in srgb, currentColor 18%, transparent))