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="pint" />
<InputText keyfilter="num" />
<InputText keyfilter="pnum" />
<InputText keyfilter="money" />
<InputText keyfilter="hex" />
<InputText keyfilter="alpha" />
<InputText keyfilter="alphanum" />
<InputText keyfilter="email" />
In addition to the presets, a regular expression can be configured for customization.
<InputText keyfilter={/[^s]/} />
<InputText keyfilter={/^[^<>*!]+$/} />
Refer to InputText for accessibility as KeyFilter is a built-in add-on of the InputText.