📄 primeng/keyfilter

File: keyfilter.md | Updated: 11/15/2025

Source: https://primeng.org/keyfilter

  • Primary

    Surface

    PresetsAuraMaterialLaraNora

    Ripple

    RTL

  • v20

  • FEATURES

  • API

KeyFilter

KeyFilter is a directive to restrict individual key strokes. In order to restrict the whole input, use InputNumber or InputMask instead.

Import #

import { KeyFilterModule } from 'primeng/keyfilter';

Presets #

KeyFilter provides various presets configured with the pKeyFilter property.

Integer

Number

Money

Hex

Alphabetic

Alphanumeric

<input pInputText pKeyFilter="int" /> <input pInputText pKeyFilter="num" /> <input pInputText pKeyFilter="money" /> <input pInputText pKeyFilter="hex" /> <input pInputText pKeyFilter="alpha" /> <input pInputText pKeyFilter="alphanum" />

Regex #

In addition to the presets, a regular expression can be configured for customization.

Block Space

Block < > * !

<input pInputText [pKeyFilter]="blockSpace" /> <input pInputText [pKeyFilter]="blockChars" />

Accessibility #

Refer to InputText for accessibility as KeyFilter is a built-in add-on of the InputText.

  • Import

  • Presets

  • Regex

  • Accessibility

Figma UI Kit

The official Figma UI Kit for Prime UI libraries, the essential resource for designing with PrimeOne components.

PrimeNG 20.3.0 by PrimeTek