@jswork/react-ant-input
v1.0.0
Published
Ant input.
Readme
react-ant-input
Ant input.
installation
npm install -S @jswork/react-ant-inputproperties
| Name | Type | Required | Default | Description | | ------------ | ------ | -------- | ------- | -------------------------------------------- | | className | string | false | - | The extended className for component. | | value | any | false | - | Default value. | | shouldTrim | bool | false | false | If the value should be trim before returned. | | autoComplete | string | false | 'off' | Should autoComplete on. | | onChange | func | false | noop | The change handler. |
usage
- import css
@import "~@jswork/react-ant-input/dist/style.css";
// or use sass
@import "~@jswork/react-ant-input/dist/style.scss";
// customize your styles:
$react-ant-input-options: ()- import js
import ReactDemokit from '@jswork/react-demokit';
import React from 'react';
import ReactDOM from 'react-dom';
import ReactAntInput from '@jswork/react-ant-input';
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 (
<ReactDemokit
className="p-3 app-container"
url="https://github.com/afeiship/react-ant-input">
<article className="message is-info">
<div className="message-header">Preview:</div>
<div className="message-body">
<ReactAntInput
name="value"
value={value}
placeholder="Please input text1..."
className="mb-2"
onChange={this.handleChange}
/>
<ReactAntInput
shouldTrim
name="value2"
placeholder="Please input text2..."
value={value2}
onChange={this.handleChange}
/>
</div>
</article>
<article className="message">
<div className="message-header">Status changed:</div>
<div className="message-body">
{JSON.stringify(this.state, null, 2)}
</div>
</article>
</ReactDemokit>
);
}
}
ReactDOM.render(<App />, document.getElementById('app'));
documentation
- https://afeiship.github.io/react-ant-input/
license
Code released under the MIT license.
