Skip to content

afeiship/react-ant-input-number

Repository files navigation

react-ant-input-number

Input number for react.

version license size download

installation

npm install -S @jswork/react-ant-input-number

properties

Name Type Required Default Description
className string false - The extended className for component.
onChange func false noop The change handler.

usage

  1. import css
@import "~@jswork/react-ant-input-number/dist/style.css";

// or use sass
@import "~@jswork/react-ant-input-number/dist/style.scss";

// customize your styles:
$react-ant-input-number-options: ()
  1. import js
import ReactDemokit from '@jswork/react-demokit';
import React from 'react';
import ReactDOM from 'react-dom';
import ReactAntInputNumber from '@jswork/react-ant-input-number';
import './assets/style.scss';

class App extends React.Component {
  handleChange = (e) => {
    console.log(e.target.value);
  };

  render() {
    return (
      <ReactDemokit
        className="p-3 app-container"
        url="https://github.com/afeiship/react-ant-input-number">
        <ReactAntInputNumber className="is-fullwidth mb-2" placeholder="Input your number." onChange={this.handleChange} />
        <ReactAntInputNumber
          className="is-fullwidth"
          defaultValue={100}
          min={0}
          max={100}
          formatter={(value) => `${value}%`}
          parser={(value) => value.replace('%', '')}
          onChange={this.handleChange}
        />
      </ReactDemokit>
    );
  }
}

ReactDOM.render(<App />, document.getElementById('app'));

documentation

license

Code released under the MIT license.