Skip to main content
cngx-src documentation

CngxInputFilter

DirectivePrimaryv0.2.0WCAG AA

projects/forms/input/input-filter.directive.ts

Import#

import { CngxInputFilter } from '@cngx/forms/input'

Description#

Restricts freeform input to a character class without a full mask.

Place on the <input>. Cancels any beforeinput insertion (typing, paste, IME commit) that contains a disallowed character and announces the rejection assertively through the shared live region - a rejected keystroke is a state change, never a silent drop (Pillar 2). Deletions and navigation are never touched. For full positional formatting use CngxInputMask; this is the lighter "digits only" tool (Pillar 3).

<input cngxInput cngxInputFilter="digits" inputmode="numeric" />
<input cngxInput [cngxInputFilter]="/[A-Za-z-]/" />

https://cngxjs.github.io/cngx/examples/#/forms/input/charset-filter

Metadata#

Host#

Index#

Inputs

HostListeners

Inputs#

input()Required

The allowed-character pattern: a preset name or a single-char RegExp.

default { alias: 'cngxInputFilter' }

HostListeners#

EventHandler
(beforeinput)beforeinput()