react-phone-code-selector
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

react-phone-code-selector

NPM License npm package

About

this library provides React components to display phone country selector.

You can pick the country with country number included and put your phone number with it.

Plus, the dataset can also be imported individually.

Installation

Using npm or yarn:

npm i react-phone-code-selector
yarn add react-phone-code-selector

Usage

It's very easy to use like below code.

import React, { useState } from 'react';
import { PhoneCodeSelector } from 'react-phone-code-selector';

type Props = {};

const CustomPhoneCodeSelector = () => {
  const [phone, setPhone] = useState<string>('');

  return (
    <PhoneCodeSelector
      width={300}
      defaultValue={phone}
      onChange={(value) => {
        setPhone(value);
      }}
    />
  );
};

with styled-components

import React, { useState } from 'react';
import { PhoneCodeSelector } from 'react-phone-code-selector';

type Props = {};

const CustomPhoneCodeSelector = () => {
  const [phone, setPhone] = useState<string>('');

  return (
    <CustomSelector
      width={300}
      defaultValue={phone}
      onChange={(value) => {
        setPhone(value);
      }}
    />
  );
};

const CustomSelector = styled(PhoneCodeSelector)`
  width: 300px;
  border-radius: 15px;
  background-color: violet;

  .selector-option {
    background-color: red;
  }

  .selector-option-item {
    &:hover {
      background-color: aqua;
    }
  }
`;

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.3
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.3
    2
  • 1.0.2
    1
  • 1.0.1
    1
  • 1.0.0
    1

Package Sidebar

Install

npm i react-phone-code-selector

Weekly Downloads

1

Version

1.0.3

License

MIT

Unpacked Size

403 kB

Total Files

24

Last publish

Collaborators

  • alexrider94