Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
mui-tel-input
Advanced tools
A phone number input designed for the React library MUI
// with npm
npm install mui-tel-input
// with yarn
yarn add mui-tel-input
import React from 'react'
import { MuiTelInput } from 'mui-tel-input'
const MyComponent = () => {
const [value, setValue] = React.useState('')
const handleChange = (newValue) => {
setValue(newValue)
}
return <MuiTelInput value={value} onChange={handleChange} />
}
import React from 'react'
import Box from '@mui/material/Box'
import Typography from '@mui/material/Typography'
import { MuiTelInput, isValidPhoneNumber } from 'mui-tel-input'
const MyComponent = () => {
const [value, setValue] = React.useState('')
const [isValid, setIsValid] = React.useState(false)
const handleChange = (newValue) => {
setIsValid(isValidPhoneNumber(newValue))
setValue(newValue)
}
return (
<Box>
<Typography>This is valid ? {isValid ? 'yes' : 'no'}</Typography>
<MuiTelInput value={value} onChange={handleChange} />
</Box>
)
}
Name | Type | Description |
---|---|---|
value | string | The phone number value (Required) |
onChange | (value, info) => void | Gets called once the user updates the input or selects a new country. |
onlyCountries? | array | Country codes to be included. |
preferredCountries? | array | Country codes to be highlighted to the top of the list of countries. |
continents? | array | Continent codes to include a list of countries. |
forceCallingCode? | boolean | Force the calling code (e.g: +33 ) to be displayed so the value cannot be empty. Default false . |
focusOnSelectCountry? | boolean | Autofocus the input when the user selects a country in the list. Default false . |
disableDropdown? | boolean | No country list / The current flag is a span instead of a button . Default false . |
langOfCountryName? | string | An Intl locale to translate countries (see Intl locales). Default en . |
MenuProps? | Menu API | Props for the Menu component. |
ref? | React.Ref<HTMLDivElement> | A ref pointing to the Mui TextField component. |
TextField Props |
While not explicitly documented above, the props of the TextField component are also available on MuiTelInput.
A "country code" is a two-letter ISO country code (like US
).
This library supports all officially assigned ISO alpha-2 country codes, plus a few extra ones like: AC
(Ascension Island), TA
(Tristan da Cunha), XK
(Kosovo).
Code | Continent |
---|---|
AF | Africa |
AS | Asia |
EU | Europe |
NA | North America |
OC | Oceania |
SA | South America |
OC | Oceania |
This library comes with TypeScript "typings". If you happen to find any bugs in those, create an issue.
Please file an issue for bugs, missing documentation, or unexpected behavior.
Please file an issue to suggest new features. Vote on feature requests by adding a 👍. This helps maintainers prioritize what to work on.
MIT
FAQs
A phone number input designed for the React library MUI built with libphonenumber-js
The npm package mui-tel-input receives a total of 66,902 weekly downloads. As such, mui-tel-input popularity was classified as popular.
We found that mui-tel-input demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.