Skip to main content
cngx-src documentation

CngxTouchTarget

Directivev0.1.0

projects/core/theming/cngx-touch-target.directive.ts

Import#

import { CngxTouchTarget } from '@cngx/core'

Description#

Scopes the touch-target mode to a subtree by reflecting [cngxTouchTarget] onto the host [data-touch] attribute. A section so marked pins the hit-area floor on / off for its descendants, overriding the media-derived default set by provideTouchTargets

  • the escape hatch, not a per-component input.
<section cngxTouchTarget="on"> ... </section>

The input accepts only 'on' / 'off': pinning a subtree is the directive's whole job. 'auto' is a root-only concept (it means "defer to the (any-pointer: coarse) media query", which never targets a subtree) and lives on provideTouchTargets instead.

The input is optional (a bare cngxTouchTarget attribute binds the empty string, coerced to undefined), so it never asserts a required binding; an unset value leaves [data-touch] off the host and the inherited floor keeps control.

Metadata#

Host#

Index#

Inputs#

default
undefined, {    alias: 'cngxTouchTarget',    transform: (value) => (value === '' ? undefined : value),  }

HostBindings#

BindingExpression
[attr.data-touch]touchTarget()