0.0.4 • Published 6 years ago

react-mobile-number-input v0.0.4

Weekly downloads
12
License
-
Repository
-
Last release
6 years ago

react-mobile-number-input

Install

npm i react-mobile-number-input

API

props

NameTypeDefaultDescription
valueNumber0Specifies the value of an InputNumber
typeStringnumberSpecifies the type
maxLenghtNumber999Specifies the max length
minLenghtNumber0Specifies the min length
patternStringSpecifies the pattern attribute
nameStringSpecifies the name attribute
requiredBooleanfalseSpecifies the required attribute
minNumbernullSpecifies the min value input
maxNumbernullSpecifies the max value input
disabledBooleanfalseSpecifies the disabled attribute
placeholderStringSpecifies the placholder attribute
readOnlyBooleanfalseSpecifies the readonly attribute
stepNumber1Specifies the increment and decrement value (triger by +/- button)
styleString{}Specifies the style attribute
onChangeFunctionCalled 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 })}
      />
    )
  } 
}