Socket
Socket
Sign inDemoInstall

gustavolbs-react-international-phone

Package Overview
Dependencies
3
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    gustavolbs-react-international-phone

☎️ International phone input component for React


Version published
Weekly downloads
60
increased by17.65%
Maintainers
1
Install size
100 kB
Created
Weekly downloads
 

Changelog

Source

4.2.7 (2024-04-15)

Bug Fixes

  • country-data: update German phone format (dab8f12)

Readme

Source

react-international-phone

🤙 International phone input component for React

npm-version build-status-badge install-size-badge codecov downloads Semantic Release stars

Live demo: Storybook

demo-gif

Features

  • 😎 Easy to integrate - Just import and use, no need for the initial setup. Integrate with any UI library using a headless hook.
  • 🔍 Country guessing - Just start typing and the component will guess the country and format the phone. Country flags are rendered using Twemoji.
  • Lightweight - Low bundle size, no third-party dependencies.
  • 🌈 Easy to customize - Customize styles and component behavior using props.
  • Caret position handling - Typing in the middle of the input, selection and deletion feels naturally.
  • ✔️ Validation - Easily validate entered phone numbers using provided functions.

Installation

$ npm i react-international-phone

Basic usage

import { useState } from 'react';
import { PhoneInput } from 'react-international-phone';
import 'react-international-phone/style.css';

const App = () => {
  const [phone, setPhone] = useState('');

  return (
    <div>
      <PhoneInput
        defaultCountry="ua"
        value={phone}
        onChange={(phone) => setPhone(phone)}
      />
    </div>
  );
};

Documentation

Find the full API reference on official documentation.

Migration

You can encounter some breaking changes after update between major versions.

Checkout migration documents that contain a list of breaking changes and ways to migrate:
Update from v3 to v4
Update from v2 to v3
Update from v1 to v2

Keywords

FAQs

Last updated on 08 Apr 2024

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc