Giter Site home page Giter Site logo

monstrag / react-phone-input-mui Goto Github PK

View Code? Open in Web Editor NEW

This project forked from harish-everest/react-phone-input-mui

0.0 0.0 0.0 2.8 MB

Highly customizable phone :telephone_receiver: input component with auto formatting

License: MIT License

JavaScript 67.89% HTML 0.31% Less 31.81%

react-phone-input-mui's Introduction

react-phone-input-material-ui

Highly customizable phone input component with auto formatting. Based on the wonderful react-phone-input-2 package.

Supports material-ui v4 and v5.

Original look:

alt tag

With The Material UI's TextField:

alt tag

Installation

npm install react-phone-input-material-ui --save

or

yarn add react-phone-input-material-ui

Usage with Material UI

Mandatory props: value and onChange for controlling field; component, ideally TextField

import React from 'react';
import ReactPhoneInput from 'react-phone-input-material-ui';
import { TextField, withStyles } from '@material-ui/core';

const styles = theme => ({
  field: {
    margin: '10px 0',
  },
  countryList: {
    ...theme.typography.body1,
  },
});


function PhoneField(props) {
  const { value, defaultCountry, onChange, classes } = props;

  return (
    <React.Fragment>
      {/* Simple usage */}
      <ReactPhoneInput
        value={value}
        onChange={onChange} // passed function receives the phone value
        component={TextField}
      />

      {/* Configure more */}
      <ReactPhoneInput
        value={value}
        defaultCountry={defaultCountry || 'gb'}
        onChange={onChange}
        inputClass={classes.field}
        dropdownClass={classes.countryList}
        component={TextField}
      />
    </React.Fragment>
  );
}

export default withStyles(styles)(PhoneField);

Forked from react-phone-input-2. All the features of react-phone-input-2 are available. I will be update this library frequently to upto date with origin library

Contributing

Code style changes not allowed

License

GitHub license

Based on react-phone-input

Make sure you donated for lib maintenance Donate

react-phone-input-mui's People

Contributors

abrahampost avatar ajmas avatar alex-ray avatar andr1o avatar andrujoh avatar awthwathje avatar bl00mber avatar cezarderevlean avatar codesignist avatar corupta avatar cristianpacu01 avatar david58 avatar dmajkowska avatar dsteinbach avatar harish-everest avatar hasanshehryarjaffri avatar mechanicalhuman avatar mmolhoek avatar newying61 avatar raitobezarius avatar sackeyjason avatar shaypeleg1 avatar smddzcy avatar thaddeusang avatar thanaen avatar trallp avatar vadimka123 avatar vaibhavarora14 avatar wgil avatar x8o7 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.