npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

ak-react-phone-input

v1.4.0

Published

A customizable phone input component for React

Downloads

125

Readme

ak-react-phone-input

AkPhoneInput is a React component for rendering a phone input field with country code selection. It provides an easy-to-use interface for users to input phone numbers, format them according to selected country codes, and automatically display the country's flag and code.

Installation

To install the ak-react-phone-input package, run the following command:

npm install ak-react-phone-input
yarn add ak-react-phone-input

Usage

Here's an example of how to use the AkPhoneInput component:

import React, { useState } from 'react';
import AkPhoneInput from 'ak-react-phone-input';

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

  const handlePhoneChange = (value: string) => {
    setPhone(value);
  };

  return (
    <div>
      <AkPhoneInput onChange={handlePhoneChange} />
      <p>Phone Number: {phone}</p>
    </div>
  );
};

AkPhoneInput Component Documentation

Props

| Prop Name | Type | Default | Description | | ------------- | ------------------------------ | --------- | --------------------------------------------------------------------------- | | onChange | (value: string) => void | Required | Callback function that is called whenever the phone number input changes. | | radius | number | 4 | The border radius for the input and dropdown (in pixels). | | variant | "default" or "filled" | "default" | The variant of the input, either "default" or "filled". | | mode | "light" or "dark" | "light" | The theme mode for the component, either "light" or "dark". | | noShadow | boolean | false | Whether the input should have a shadow or not. |

Component Internal Behavior

| Feature | Description | | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Country Selection | Users can select a country from a dropdown list, which automatically updates the country code and flag. | | Phone Mask | Based on the selected country, the phone number input will be masked in a format appropriate for that country. | | Phone Number Formatting | As users input their phone number, it is automatically formatted according to the mask for the selected country. | | Responsive Dropdown | The country dropdown opens either upwards or downwards depending on available space in the viewport. |

Key Features

| Feature | Description | | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Country Flag and Code | Displays the flag and country code of the selected country, making it easy for users to identify the country. | | Searchable Country Dropdown | Users can search through available countries, making it quicker to find the country they need. | | Input Masking | Automatically formats phone numbers based on the selected country's phone number format. |

Styling Customization

| Style | Description | | ---------------- | ------------------------------------------------------------------------------------------------- | | borderRadius | Customize the input's corner radius. | | variant | Choose between a "default" or "filled" input style. | | mode | Choose between "light" or "dark" theme for the component. | | noShadow | Disable input shadow if set to true. |

To override the default styles, you can add custom CSS in your project:

.ak-phone-input-main {
  // Your custom styles
}

.ak-phone-input-root {
  // Your custom styles
}

Example

import AkPhoneInput from 'ak-react-phone-input';
import { useState } from 'react';

const MyForm = () => {
  const [phoneNumber, setPhoneNumber] = useState('');

  const handlePhoneChange = (value: string) => {
    setPhoneNumber(value);
  };

  return (
    <div>
      <AkPhoneInput onChange={handlePhoneChange} variant="filled" mode="dark" />
      <p>Selected Phone Number: {phoneNumber}</p>
    </div>
  );
};

export default MyForm;

License

License

This project is licensed under the MIT License - see the LICENSE file for details.