Skip to main content
cngx-src documentation

CngxButtonMultiToggleGroupContract

Interface

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

Referenced by#

Import#

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

Description#

Multi-select parent contract every CngxButtonMultiToggleGroup provides via useExisting. CngxButtonToggle leaves that detect a multi-mode parent (via inject(CNGX_BUTTON_MULTI_TOGGLE_GROUP, { optional: true })) bind aria-selected (toolbar APG) instead of aria-checked (radiogroup APG) AT INJECTION TIME. Mode is static per atom instance - there is no [selectionMode] flag.

selectedValues is a ModelSignal<T[]> so the consumer can two-way-bind via [(selectedValues)] and the leaves can mutate it on toggle. disabled is a read-only Signal<boolean> the leaf combines with its own per-toggle disabled().

isSelected(value) returns the per-value membership signal from the group's internal SelectionController so the leaf can render aria-selected reactively without re-querying the array on every keystroke. The signal identity is stable per value (per createSelectionController contract) - safe to read inside a computed() on the leaf.

toggle(value) is the single mutation entry-point the leaf calls on Space / Enter / click. The group routes it through its controller and writes selectedValues accordingly.

Index#

Instance Properties#

disabled#Signal
Readonly
selectedValues#ModelSignal
Readonly

Methods#

isSelected#Signal
isSelected(value: T)
@paramvalueT
toggle#void
toggle(value: T)
@paramvalueT