Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
react-input-mask
Advanced tools
Readme
Yet another React component for input masking with attention to small usability details with cursor position, copy-paste, etc.
npm install react-input-mask --save
mask
: string
Mask string. Format characters are:
9
: 0-9
a
: A-Z, a-z
*
: A-Z, a-z, 0-9
Any character can be escaped with backslash, which usually will appear as double backslash in JS strings. For example, German phone mask with unremoveable prefix +49 will look like mask="+4\9 99 999 99"
or mask={"+4\\9 99 999 99"}
maskChar
: string
Character to cover unfilled editable parts of mask. Default character is "_". If set to null, unfilled parts will be empty, like in ordinary input.
formatChars
: object
Defines format characters with characters as keys and corresponding RegExp string as values. Default ones:
{
"9": "[0-9]",
"a": "[A-Za-z]",
"*": "[A-Za-z0-9]"
}
alwaysShowMask
: boolean
Show mask even in empty input without focus.
import InputMask from 'react-input-mask';
class PhoneInput extends React.Component {
render() {
return <InputMask {...this.props} mask="+4\9 99 999 99" maskChar=" "/>;
}
}
Screen keyboard backspace may not work in Android 4.x browser due to broken input events.
Thanks to BrowserStack for help with testing on real devices
FAQs
Masked input component for React
We found that react-input-mask demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).