
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
phone-input-lib
Advanced tools
A lightweight, developer-friendly npm library that provides a phone number input component with flags, country codes, and Tailwind support.
A lightweight, developer-friendly npm library that provides a phone number input component with flags, country codes, and Tailwind support.
This library is compatible with React 16.8+ and has been tested with multiple React versions to ensure broad compatibility.
npm install phone-input-lib
import { PhoneInput } from 'phone-input-lib';
function MyComponent() {
const [phone, setPhone] = useState('');
return <PhoneInput value={phone} onChange={setPhone} />;
}
import { PhoneInput } from 'phone-input-lib';
function MyComponent() {
const [phone, setPhone] = useState('');
return (
<PhoneInput
value={phone}
onChange={setPhone}
className="flex gap-2 items-center"
inputClassName="border p-2 rounded"
selectClassName="p-2"
/>
);
}
import { PhoneInput } from 'phone-input-lib';
function MyComponent() {
const [phone, setPhone] = useState('');
return <PhoneInput value={phone} onChange={setPhone} showFlags={false} />;
}
Prop | Type | Default | Description |
---|---|---|---|
value | string | '' | The phone number value |
onChange | (value: string) => void | required | Callback when phone number changes |
defaultCountry | string | 'us' | Default selected country ISO code |
className | string | '' | CSS class for the container |
inputClassName | string | '' | CSS class for the input field |
selectClassName | string | '' | CSS class for the country select |
showFlags | boolean | true | Whether to show country flags |
disabled | boolean | false | Whether the input is disabled |
placeholder | string | 'Phone number' | Input placeholder text |
required | boolean | false | Whether the input is required |
error | boolean | false | Whether to show error state |
Returns an object with:
isValid
: boolean - whether the phone number is validformattedValue
: string - formatted phone numbernationalFormat
: string - national format of the phone numberinternationalFormat
: string - international format of the phone numbere164Format
: string - E.164 format of the phone numbercountryCode
: string - detected country codeA standalone country selector component.
import { CountrySelect } from 'phone-input-lib';
function MyComponent() {
const [country, setCountry] = useState('us');
return (
<CountrySelect
value={country}
onChange={setCountry}
className="p-2 border rounded"
/>
);
}
A standalone flag icon component.
import { FlagIcon } from 'phone-input-lib';
function MyComponent() {
return <FlagIcon country={countryData} className="mr-2" />;
}
MIT
FAQs
A lightweight, developer-friendly npm library that provides a phone number input component with flags, country codes, and Tailwind support.
The npm package phone-input-lib receives a total of 7 weekly downloads. As such, phone-input-lib popularity was classified as not popular.
We found that phone-input-lib demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.