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

antd-phone-input

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

antd-phone-input

Advanced Phone Number Input for Ant Design

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.7K
increased by62.67%
Maintainers
1
Weekly downloads
 
Created
Source

antd-phone-input

Advanced Phone Number Input for Ant Design.

npm types License PRs Welcome Tests

Install

npm i antd-phone-input
yarn add antd-phone-input

Usage

Antd 4.x

import React from "react";
import PhoneInput from "antd-phone-input";
import FormItem from "antd/es/form/FormItem";

const Demo = () => {
  return (
    <FormItem name="phone">
      <PhoneInput enableSearch/>
    </FormItem>
  )
}

Antd 5.x

v5.x does not have support yet
this issue is covered in GH-20

Value

The value of the component is an object containing the parts of a phone number. This format of value gives a wide range of opportunities for handling the data in your custom way. For example, you can easily merge the parts of the phone number into a single string.

{
  "countryCode": 1,
  "areaCode": 702,
  "phoneNumber": "1234567",
  "isoCode": "us"
}

Props

PropertyDescriptionType
sizeEither large, middle or small. Default value is middle. See at ant docs for more.string
valueAn object containing the parts of phone number. E.g. value={{countryCode: 1, areaCode: 702, phoneNumber: "1234567"}}.object
styleApplies CSS styles to the container element.CSSProperties
classNameThe value will be assigned to the container element.string
disabledDisables the whole input component.boolean
enableSearchEnables search in the country selection dropdown menu. Default value is false.boolean
disableDropdownDisables the manual country selection through the dropdown menu.boolean
inputPropsHTML properties of input to pass into the input. E.g. inputProps={{autoFocus: true}}.InputHTMLAttributes
searchPlaceholderThe value is shown if enableSearch is true. Default value is search.string
searchNotFoundThe value is shown if enableSearch is true and the query does not match any country. Default value is No entries to show.string
placeholderCustom placeholder. Default placeholder is 1 (702) 123-4567.string
countryCountry code to be selected by default. By default, it will show the flag of the user's country.string
regionsShow only the countries of the specified regions. See the list of available regions.string[]
onlyCountriesCountry codes to be included in the list. E.g. onlyCountries={['us', 'ca', 'uk']}.string[]
excludeCountriesCountry codes to be excluded from the list of countries. E.g. excludeCountries={['us', 'ca', 'uk']}.string[]
preferredCountriesCountry codes to be at the top of the list. E.g. preferredCountries={['us', 'ca', 'uk']}.string[]
onChangeCallback when the user is inputting. See at ant docs for more.function(value, e)
onPressEnterThe callback function that is triggered when Enter key is pressed.function(e)
onFocusThe callback is triggered when the input element is focused.function(e, value)
onClickThe callback is triggered when the user clicks on the input element.function(e, value)
onBlurThe callback is triggered when the input element gets blurred or unfocused.function(e, value)
onKeyDownThe callback is triggered when any key is pressed down.function(e)
onMountThe callback is triggered once the component gets mounted.function(e)

Contribute

Any contribution is welcome. If you have any ideas or suggestions, feel free to open an issue or a pull request. And don't forget to add tests for your changes.

License

Copyright (C) 2023 Artyom Vancyan. MIT

Keywords

FAQs

Package last updated on 03 Mar 2023

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