Skip to main content
cngx-src documentation

CngxDir

DirectivePrimaryv0.1.0

projects/core/bidi/cngx-dir.directive.ts

Import#

import { CngxDir } from '@cngx/core'

Description#

Scopes the writing direction of a subtree by reflecting [cngxDir] onto the host [attr.dir] - the escape hatch for a directional island (an LTR code block inside an RTL document, or vice versa), not a per-component input.

<section cngxDir="rtl"> ... </section>

This scopes DOM/CSS direction only: CSS logical properties and native bidi flip correctly for the subtree. It does not fork the injectDirection DI signal - that reader stays document-root scoped (registered debt: subtree/re-parenting is untracked). A composite whose keyboard-nav logic must honour a forced subtree direction supplies provideDirectionAt in its viewProviders; CngxDir alone changes what the browser lays out, not what injectDirection() reports.

The input is optional (a bare cngxDir attribute binds the empty string, coerced to undefined), so it never asserts a required binding; an unset value leaves [dir] off the host.

https://cngxjs.github.io/cngx/examples/#/core/bidi/rtl/direction-sensitive-surfaces

Metadata#

Host#

Index#

HostBindings

Inputs#

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

HostBindings#

BindingExpression
[attr.dir]direction()