Skip to main content
cngx-src documentation

CngxButtonToggleGroupContract

Interface

projects/common/interactive/button-toggle/button-toggle-group.token.ts

Referenced by#

Import#

import { CngxButtonToggleGroupContract } from '@cngx/common/interactive'

Description#

Single-select parent contract every CngxButtonToggleGroup provides via useExisting. CngxButtonToggle leaves inject this token (or CNGX_BUTTON_MULTI_TOGGLE_GROUP for the multi case) - never the concrete group class - so the leaf stays decompose-ready and free of cyclic type dependencies.

value is a ModelSignal<T | undefined> because the group's canonical value is two-way-bindable from the consumer ([(value)]) and the active leaf writes it via value.set(this.value()) on pick. disabled is a read-only Signal<boolean> so the leaf can combine it with its own per-toggle disabled() to compute toggleDisabled.

Index#

Instance Properties#

disabled#Signal
Readonly
value#ModelSignal
Readonly

Methods#

consumePendingArrowSelect#boolean
consumePendingArrowSelect(value: T)

Consume the group's "last interaction was a roving-arrow keydown" flag. Called by a leaf's (focus) handler - when the flag is true, the leaf forwards its value to the group's value model (W3C APG auto-select-on-arrow-nav semantics, radiogroup variant) and the flag is cleared so a subsequent Tab-into focus does not double-select. Returns whether the group actually consumed the flag, so the leaf can short-circuit redundant work.

@paramvalueT