CngxButtonMultiToggleGroup
cngx-button-multi-toggle-group
projects/common/interactive/button-toggle/button-multi-toggle-group.component.ts
Import#
import { CngxButtonMultiToggleGroup } from '@cngx/common/interactive'
Description#
Multi-select button-toggle group. Owns a selectedValues = model<T[]>([]) (the canonical multi-value source) and exposes the
parent contract via CNGX_BUTTON_MULTI_TOGGLE_GROUP.
Behaves as a W3C APG toolbar - arrow keys MOVE focus only (no auto-select);
Space and Enter on a focused leaf toggle that leaf's membership.
Mode is static: this is the multi-select half of the
deliberate single/multi split (per
feedback_select_family_split). Consumers pick this component or
<cngx-button-toggle-group> at template authoring time. Leaves
(CngxButtonToggle) inject EITHER token with { optional: true }
and choose aria-checked (single) vs aria-selected (multi)
AT INJECTION TIME, never at runtime.
Internals lean on createSelectionController from
@cngx/core/utils for membership tracking - the controller's
stable per-value isSelected signals (memoised by key) let leaves
read membership inside their own computed() without triggering a
fresh array walk on every change-detection pass.
value is a structural alias of selectedValues so the group
satisfies CngxControlValue<T[]> without owning two synchronised
models - both names point to the same ModelSignal<T[]> instance.
<cngx-button-multi-toggle-group label="Filters" [(selectedValues)]="filters">
<button cngxButtonToggle value="open">Open</button>
<button cngxButtonToggle value="closed">Closed</button>
<button cngxButtonToggle value="archived">Archived</button>
</cngx-button-multi-toggle-group>Metadata#
Host#
Providers#
CNGX_BUTTON_MULTI_TOGGLE_GROUP- useExisting
CngxButtonMultiToggleGroup CNGX_CONTROL_VALUE- useExisting
CngxButtonMultiToggleGroup CNGX_FORM_FIELD_CONTROL- useExisting
CngxButtonMultiToggleGroup
Relationships
Index#
Derived State
HostBindings
Inputs#
string | nullOptional id of an external error message element. When set, the
host emits aria-errormessage="<id>"; consumers MUST render an
element with that id. Default null skips the attribute.
Note: WAI-ARIA dictates that AT ignores this attribute when
aria-invalid is absent or "false", so a stable always-emitted
id is harmless when the field is valid.
nullBridge-writable invalid state. model<boolean> mirrors disabled
so external integrations (RF/Signal-Forms bridges, custom validity
adapters) can drive it without a parallel API path - consumers
typically read only.
false(value: T) => unknown(v) => vstring | undefinedOutputs#
Bridge-writable invalid state. model<boolean> mirrors disabled
so external integrations (RF/Signal-Forms bridges, custom validity
adapters) can drive it without a parallel API path - consumers
typically read only.
T[]Instance Properties#
Methods#
HostBindings#
| Binding | Expression |
|---|---|
[attr.id] | id() |
[attr.aria-label] | label() |
[attr.aria-disabled] | disabled() ? "true" : null |
[attr.aria-required] | required() ? "true" : null |
[attr.aria-invalid] | (invalid() || errorState()) ? "true" : null |
[attr.aria-errormessage] | errorMessageId() |
[attr.aria-orientation] | orientation() |
[attr.aria-busy] | ariaBusy() ? "true" : null |
[class.cngx-button-multi-toggle-group--horizontal] | orientation() === "horizontal" |
HostListeners#
| Event | Handler |
|---|---|
(focusin) | focusin() |
(focusout) | focusout() |
Default visuals for the shared button-toggle group container.
The host carries either .cngx-button-toggle-group (single-select
CngxButtonToggleGroup) or .cngx-button-multi-toggle-group
(multi-select CngxButtonMultiToggleGroup). Children sit flush so
the row reads as a segmented control.
Variants
--horizontal- flex-direction row (the default); a:not()rule on the scope root flips to column when this class is absent
Inheritance
Layout tokens cascade through the foundation:
--cngx-button-toggle-group-gap- direct (defaults to0)--cngx-button-toggle-group-radius->--cngx-radius-md
Index#
Layout
*0Gap between toggle children. Zero by default so the buttons read as a segmented control.
*0.375remCorner radius of the group container. Defaults to --cngx-radius-md.