KeyFilter

KeyFilter is a built-in feature of InputText to restrict user input based on a regular expression.


import { InputText } from 'primereact/inputtext';
         

KeyFilter provides various presets configured with the keyfilter property.


<InputText keyfilter="int" />
<InputText keyfilter="num" />
<InputText keyfilter="money" />
<InputText keyfilter="hex" />
<InputText keyfilter="alpha" />
<InputText keyfilter="alphanum" />
         

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


<InputText keyfilter={/[^s]/} />
<InputText keyfilter={/^[^<>*!]+$/}  />
         
Accessibility guide documents the specification of this component based on WCAG guidelines, the implementation is in progress.

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

Visit the API documentation for detailed information about all the properties, events and methods of the component.