@uplab/antd-country-phone-input
v1.0.3
Published
Country phone input component as standard Ant.Design form item
Downloads
109
Readme
antd-country-phone-input
Country phone input component as standard Ant.Design form item.
Currently supports 53 languages (ISO 3166-1 Alpha-2) Default language is Chinese (zh)
Installation
npm i antd-country-phone-input
Usage
import React from "react";
import ReactDOM from "react-dom";
import { Form } from "antd";
import CountryPhoneCode from "antd-country-phone-input";
import "antd/dist/antd.css";
const App = ({ form }) => {
const submit = e => {
e.preventDefault();
form.validateFields((err, values) => {
if (!err) {
console.log("Received values of form: ", values);
}
});
};
return (
<Form onSubmit={submit}>
<Form.Item>
{form.getFieldDecorator("countryPhone")(<CountryPhoneCode />)}
</Form.Item>
</Form>
);
};
const WrappedApp = Form.create({
mapPropsToFields(props) {
return {
countryPhone: Form.createFormField({
value: { code: 86, phone: "13012345678", short: "CN" },
lang: en
})
};
}
})(App);
const rootElement = document.getElementById("root");
ReactDOM.render(<WrappedApp />, rootElement);
Supported languages (ISO 639-1)
ar
: Arabicaz
: Azerbaijanibe
: Belorussianbg
: Bulgarianbn
: Bengalibs
: Bosnianca
: Catalancs
: Czechda
: Danishde
: Germanen
: Englishes
: Spanishet
: Estonianfa
: Persianfi
: Finnishfr
: Frenchgl
: Galicianel
: Greekhe
: Hebrewhi
: Hindihr
: Croatianhu
: Hungarianhy
: Armenianit
: Italianid
: Indonesianja
: Japaneseka
: Georgiankk
: Kazakhko
: Koreanky
: Kyrgyzlt
: Lithuanianlv
: Latvianmk
: Macedonianmn
: Mongolianms
: Malaynb
: Norwegian Bokmålnl
: Dutchnn
: Norwegian Nynorskpl
: Polishpt
: Portuguesero
: Romanianru
: Russiansk
: Slovaksl
: Slovenesr
: Serbiansv
: Swedishth
: Thaitr
: Turkishuk
: Ukrainianur
: Urduuz
: Uzbekzh
: Chinesevi
: Vietnamese