Skip to main content
cngx-src documentation

withCustomTokens

Functionforms/input

projects/forms/input/input-config.ts

Description#

Registers mask tokens globally, beyond the built-in 0 9 A a *.

  • Each token maps one mask character to a pattern regex, an optional flag, and an optional per-char transform.
  • Use it when a pattern needs a character class the built-ins lack (hex digit, restricted letter set) across the app rather than per input.
  • Merged as { ...config.customTokens, ...input.customTokens }, so a per-input [customTokens] entry overrides the global one of the same key.
provideInputConfig(withCustomTokens({
  H: { pattern: /[0-9a-fA-F]/, transform: (c) => c.toUpperCase() },
}));
// <input cngxInputMask="#HHHHHH" />

Signature#

withCustomTokens(tokens: MaskTokenMap)

Parameters#

@paramtokensMaskTokenMap

Returns#

InputConfigFeature