1.0.0 • Published 4 years ago

@feizheng/react-ant-input v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

react-ant-input

Ant input.

installation

npm install -S @feizheng/react-ant-input

update

npm update @feizheng/react-ant-input

properties

NameTypeDefaultDescription
classNamestring-The extended className for component.
valueany-Default value.
shouldTrimboolfalseIf the value should be trim before returned.
autoCompletestring'off'
onChangefuncnoopThe change handler.

usage

  1. import css

    @import "~@feizheng/react-ant-input/dist/style.scss";
    
    // customize your styles:
    $react-ant-input-options: ()
  2. import js

    import ReactAntInput from '@feizheng/react-ant-input';
    import ReactDOM from 'react-dom';
    import React from 'react';
    import './assets/style.scss';
    
    class App extends React.Component {
      state = {
        value: '',
        value2: ''
      };
    
      handleChange = (inEvent) => {
        this.setState({
          [inEvent.target.name]: inEvent.target.value
        });
      };
    
      render() {
        const { value, value2 } = this.state;
    
        return (
          <div className="app-container">
            <ReactAntInput
              name="value"
              value={value}
              onChange={this.handleChange}
            />
    
            <ReactAntInput
              shouldTrim
              name="value2"
              value={value2}
              onChange={this.handleChange}
            />
          </div>
        );
      }
    }
    
    ReactDOM.render(<App />, document.getElementById('app'));

documentation