1.1.8 • Published 4 years ago

react-input-with-keyboard v1.1.8

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

React Input with Keyboard ⌨️

Preview

npm.io

Watch Demo Here

Installation

You can install this package with the following command:

yarn add react-input-with-keyboard

or

npm install react-input-with-keyboard

How to use

you can also see this example

Usage

import React, { Component } from "react";
import { TextInput, Textarea } from "react-input-with-keyboard";
import "./App.css";

// don't forget to import css file.
import "react-input-with-keyboard/dist/index.css";

class App extends Component {
  constructor(props) {
    super(props);

    this.state = {
      input1Val: "",
      input2Val: "",
      input3Val: ""
    };
  }
  onChangeTextField = (key, value) => {
    this.setState({
      [key]: value
    });
  };

  render() {
    const { input1Val, input2Val, input3Val } = this.state;
    return (
      <div className="App">
        <TextInput
          text={"Input with full keyboard"}
          placeholder="Please Scan Your Badge..."
          value={input1Val}
          containerClassName="inpContainer"
          keyboardKeyClassName="keyboardKeyStyles"
          onChange={text => this.onChangeTextField("input1Val", text)}
        />
        <TextInput
          text={"Input with numaric keyboard"}
          placeholder="Please Scan Your Badge..."
          value={input2Val}
          fullKeyboard={false}
          type="number"
          keyboardKeyContainerClassName="keyContainerClass"
          containerClassName="inpContainer"
          onChange={text => this.onChangeTextField("input2Val", text)}
        />
        <Textarea
          text={"Textarea with keyboard"}
          value={input3Val}
          fullKeyboard={true}
          onChange={value => this.onChangeTextField("input3Val", value)}
          containerClassName="inpContainer"
        />
      </div>
    );
  }
}

export default App;

Props

PropsTypeNotes
containerClassNamestringclassName of the main Input wrapper.
textstringHeading of Input.
textStylesstringHeading className
errorboolfor showing error
inputClassNamestringinput className
placeholderstringplaceholder of the input
valuestringvalue of the input
sizestringsize of the input, i.e. large default and small
onFocusfunctioncallback function for onFocus event
onBlurfunctioncallback function for onBlur event
onChangefunctioncallback function for onChange event
typestringtype of input, i.e text number etc.
disabledboolflag for disable the input or not.
idstringid for the input.
fullKeyboardboolflag for allow full keyboard on input or just numaric keyboard
hideOnSmallDeviceboolif you want to hide keyboard icon on small devices like moble and tablets
keyboardIconReact.nodeicon for the keyboard, which is show on right side of the input
keyboardIconColorstringcolor of the keyboard icon
iconClassNamestringclassName for keyboard icon
keyboardKeyClassNamestringclassName for the text inside the keyboard's key
keyboardKeyContainerClassNamestringclassName for the keyboard's key
1.1.8

4 years ago

1.1.7

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago