viclafouch / mui-tel-input

📌 A phone number input designed for MUI (Material ui) V6 built with libphonenumber-js
https://viclafouch.github.io/mui-tel-input
MIT License
158 stars 65 forks source link
material-ui mui number phone-number react typescript

Material UI tel input

A phone number input designed for the React library Material UI

[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/viclafouch/mui-tel-input/blob/master/LICENSE) ![ts](https://badgen.net/badge/Built%20With/TypeScript/blue) [![npm](https://img.shields.io/npm/v/mui-tel-input)](https://www.npmjs.com/package/mui-tel-input)

Installation

// with npm
npm install mui-tel-input

// with yarn
yarn add mui-tel-input

The component uses libphonenumber-js for phone number parsing and formatting.

Usage

import React from 'react'
import { MuiTelInput } from 'mui-tel-input'

const MyComponent = () => {
  const [value, setValue] = React.useState('')

  const handleChange = (newValue) => {
    setValue(newValue)
  }

  return <MuiTelInput value={value} onChange={handleChange} />
}

Next.js integration

Learn how to use MUI Tel Input with Next.js.

Once you have installed MUI Tel Input in your next.js project, it is important to transpile it as it is an ESM package first.

/** @type {import('next').NextConfig} */
const nextConfig = {
 transpilePackages: ['mui-tel-input'],
 // your config
}

module.exports = nextConfig

Documentation

Changelog

Go to GitHub Releases

TypeScript

This library comes with TypeScript "typings". If you happen to find any bugs in those, create an issue.

🐛 Bugs

Please file an issue for bugs, missing documentation, or unexpected behavior.

💡 Feature Requests

Please file an issue to suggest new features. Vote on feature requests by adding a 👍. This helps maintainers prioritize what to work on.

LICENSE

MIT