react-mobile-number-input

React number input make simple

Usage no npm install needed!

<script type="module">
  import reactMobileNumberInput from 'https://cdn.skypack.dev/react-mobile-number-input';
</script>

README

react-mobile-number-input

Install

npm i react-mobile-number-input

API

props

Name Type Default Description
value Number 0 Specifies the value of an InputNumber
type String number Specifies the type
maxLenght Number 999 Specifies the max length
minLenght Number 0 Specifies the min length
pattern String Specifies the pattern attribute
name String Specifies the name attribute
required Boolean false Specifies the required attribute
min Number null Specifies the min value input
max Number null Specifies the max value input
disabled Boolean false Specifies the disabled attribute
placeholder String Specifies the placholder attribute
readOnly Boolean false Specifies the readonly attribute
step Number 1 Specifies the increment and decrement value (triger by +/- button)
style String {} Specifies the style attribute
onChange Function Called when value of an InputNumber changed

Usage

import NumberInput from 'react-mobile-number-input';
import '../node_modules/react-mobile-number-input/assets/numberInput.css'

export default class App extends React.Component {

  constructor(props) {
    super(props)
    this.state = {
      num: 0
    }
  }

  render() {
    return (
      <NumberInput
        value={this.state.num}
        onChange={() => this.setState({ num: this.state.num + 1 })}
      />
    )
  } 
}