Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-simple-phone-input

Package Overview
Dependencies
Maintainers
1
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-simple-phone-input

A simple react phone input component with calling code dropdown🤷

  • 3.1.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
693
decreased by-6.73%
Maintainers
1
Weekly downloads
 
Created
Source

React Simple Phone Input

A simple and customizable react phone number dropdown component. It can mixed up with your designed theme and give a fluent vibeable dropdown area in your next project.

npm version npm downloads PRs Welcome MIT licensed

Installation

$ npm i react-simple-phone-input --save

Installation

import { PhoneInput } from "react-simple-phone-input";
//or
//const { PhoneInput } = require("react-simple-phone-input")

<PhoneInput
    country="US"
    placeholder="Add your phone"
    onChange={(data) => console.log(data)}
/>
See Demo

Options

Name Type Description Is Required Example
country string initial country required "BD"
placeholder string Input Field Placeholder Text required Type your phone number
value string Input field state value or default value optional
iconComponent ReactNode Dropdown Icon component for changing default icon optional <Icon icon="icon-name" />
inputProps InputHTMLAttributes Props to pass into the input field optional
onlyCountries array Show only country in dropdown menu with Country Codes optional ["BD", "US", "AF", "AL"]
excludeCountries array If you want to remove some country to the list. If you give excludeCountries then onlyCountries not works optional ["AF", "AL"]
preferredCountries array Country codes to show on the top of the dropdown menu optional ["BD", "US"]
searchPlaceholder string Search input field placeholder optional
searchIconComponent ReactNode If search enabled, custom search icon to show on search bar optional <Icon icon="icon-name" />
searchProps InputHTMLAttributes Props to pass into the search input field optional
searchNotFound string Error message when search result is empty! optional

Other Options

Name Default Description
showDropdownIcon true Show or Hide dropdown icon
dialCodeInputField false Show calling code into into field or show beside country flag. For more, see example
search true Show or Hide search input field
showSearchIcon true Show or Hide search icon

Event

Event Name Description Example
onChange To get the value from component onChange={(data: string) => console.log(data)}

Contributing

  • Code style changes not allowed
  • Do not create issues about incorrect or missing country data

Issues or correction

If you face any issues, missing data or wrong data about country, you are welcome to create an issue.

Stay in touch

License

MIT licensed

Keywords

FAQs

Package last updated on 20 Dec 2022

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc