Skip to main content
cngx-src documentation

CngxOption

DirectivePrimaryv0.1.0WCAG AA

projects/common/interactive/listbox/option.directive.ts

Import#

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

Description#

Metadata#

Host#

Providers#

CNGX_AD_ITEM
useExisting CngxOption
CNGX_OPTION_CONTAINER
useExisting CngxOption

Relationships

Index#

Inputs#

disabled#boolean
input()

Disabled options are skipped in navigation and reject clicks.

default false
labelInput#string | undefined
input()

Optional explicit label used by typeahead. Falls back to trimmed textContent.

default undefined, { alias: 'label' }
value#unknown
input()

Opaque value emitted on activation.

Instance Properties#

id#unknown
Readonly

Stable unique id set on the host, used by aria-activedescendant.

nextUid('cngx-option')
isSelected#unknown
Readonly

Whether this option is selected. Driven externally by the enclosing listbox via markSelected(). Standalone use (without a listbox) always returns false.

this.selectedState.asReadonly()
kind#unknown
Readonly

Discriminator for CNGX_OPTION_CONTAINER consumers.

'option' as const
resolvedLabel#unknown
Readonly

Back-compat callable alias - CngxAdItemHandle.label accepts both Signal<string> and () => string, so this arrow keeps any consumer that called option.resolvedLabel() imperatively working unchanged.

() => {...}

Methods#

handleClick#void
Protected
handlePointerEnter#void
Protected

HostBindings#

BindingExpression
[id]id
[class.cngx-option--selected]isSelected()
[class.cngx-option--highlighted]isHighlighted()
[class.cngx-option--disabled]disabled()
[attr.aria-selected]isSelected()
[attr.aria-disabled]disabled() || null
[attr.data-status]statusSignal()?.kind ?? null
[class.cngx-option--hidden]hidden()
[attr.hidden]hidden() || null

HostListeners#

EventHandler
(click)click()
(pointerenter)pointerenter()