Skip to main content
cngx-src documentation

CngxFieldSkinHost

Directivev0.1.0WCAG AA

projects/forms/field/field-skin.directive.ts

Import#

import { CngxFieldSkinHost } from '@cngx/forms/field'

Description#

Resolves the appearance of one control and writes it to its own host as data-skin, which is what the skin CSS scopes on.

One responsibility: the cascade, evaluated in a single computed().

own [cngxFieldSkin]  ->  surrounding field's [skin]  ->  withFieldSkin(...)  ->  'outline'

'outline' resolves to null, so the default emits no attribute at all and existing DOM stays byte-identical - the base layer already paints the outline look.

The surrounding field is read through CNGX_FORM_FIELD_HOST, optionally. A control outside any cngx-form-field - a table filter input, a toolbar control - still resolves its own input and the app-wide default, which is exactly what the bare skin is for.

Where it is already composed. CngxInput, CngxAffixRow and the nine select-family triggers host this directive and re-alias its input to the short skin, so <input cngxInput skin="bare"> works out of the box.

CngxFormField does NOT host it - the field is display: contents and has no box to paint. It forwards its own [skin] into CngxFormFieldPresenter, which publishes the raw value on CNGX_FORM_FIELD_HOST; every control inside then resolves it through the cascade above. Binding [cngxFieldSkin] on cngx-form-field itself does nothing.

Controls that do not host cngxInput opt in with the explicit attribute: CngxNumericInput, CngxInputMask, CngxInputFormat, CngxOtpSlot, input[cngxListboxSearch], input[cngxSearch], input[cngxDgaFilter]. They are not reached by withFieldSkin(...) either - the config tier is read by this directive, so a control that does not compose it stays on the base outline look until the attribute is set.

<input cngxNumericInput cngxFieldSkin="bare" />

https://cngxjs.github.io/cngx/examples/#/forms/select/single-select/signal-forms-required https://cngxjs.github.io/cngx/examples/#/forms/select/multi-select/multi-basic

Metadata#

Host#

Index#

Inputs

Derived State

HostBindings

Inputs#

input()

Appearance for this control. Unset falls through to the field, then the config. The valueless attribute form (<input cngxFieldSkin>, how a host composes the directive without binding it) reads as '' and is normalised to "unset", mirroring the CngxContrast / CngxDensity theming axes.

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

HostBindings#

BindingExpression
[attr.data-skin]dataSkin()