useKeyFilter

    useKeyFilter used to block individual keystrokes based on a pattern.

    Usage#

    import { useKeyFilter } from '@primereact/hooks';
    const keyfilter = useKeyFilter();

    Examples#

    Pattern#

    useKeyFilter provides various presets configured with the pattern option.

    The component referenced as hooks:usekeyfilter:pattern-demo is unavailable or does not exist.

    Regex#

    In addition to the presets, a regular expression can be configured for customization of blocking a single key press.

    The component referenced as hooks:usekeyfilter:regex-demo is unavailable or does not exist.

    Regex Word#

    In addition to the presets, a regular expression can be used to validate the entire word using validateOnly option.

    The component referenced as hooks:usekeyfilter:regex-word-demo is unavailable or does not exist.