0.4.2 • Published 5 years ago

react-simple-input v0.4.2

Weekly downloads
20
License
MIT
Repository
github
Last release
5 years ago

react-simple-input

A simple text input for React

⚠️ Warning: This package was built at a time where React was not as popular as it is today. I am deprecating as most of what this package offer is easily re-doable in a serious codebase.

Description

react-simple-input is a small text input component with some utilities, like a timeOut before onChange is triggered, a clear button... If there is any feature you want, please open an issue.

Examples

Import it in your project:

import SimpleInput from 'react-simple-input'; // ES6
var SimpleInput = require('react-simple-input'); // ES5

Classic input with a placeholder

<SimpleInput placeholder='search' />

Classic input with a default value and a clear button

<SimpleInput defaultValue='a default value' clearButton />

Input with an onChange function, executing it 250ms after input change

<SimpleInput changeTimeout={250} onChange={ (value) => { console.log(value) } } />

For other props, see options.

Options

PropertyDescriptionTypeDefault value
classNamethe classes you want to pass to the component intputString""
classNameContainerthe classes you want to pass to the component containerString""
defaultValuethe default value of your inputString""
placeholderthe placeholder you want for your inputString""
eventsTimeoutsthe time you want to wait before an event is thrown to you (usefull to avoid too many calls to onChange ect...)Object{ onChange: 0, onKeyDown: 0, onKeyUp: 0, onKeyPress: 0 }
clearButtonAdd a clear button to clear the input in one clickBooleanfalse
selectOnClickselect the input text when the input is clickedBooleanfalse
onChangethe function called when the input changes*Function(e) => {}
onKeyDownthe function called when the input receives a keyDown event*Function(e) => {}
onKeyUpthe function called when the input receives a keyUp event*Function(e) => {}
onKeyPressthe function called when the input receives a keyPress event*Function(e) => {}
onClickthe function called when the input is clicked*Function(e) => {}

* the event returned is a React synthetic event. If you need the native event, use e.nativeEvent

0.4.2

5 years ago

0.4.1

6 years ago

0.4.0

7 years ago

0.3.1

8 years ago

0.3.0

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago