Giter Site home page Giter Site logo

samad324 / react-input-with-keyboard Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 1.0 2.57 MB

A React input component with keyboard, see demo on

Home Page: https://samad324.github.io/react-input-with-keyboard-example/

JavaScript 78.27% CSS 19.25% HTML 2.48%
react react-input react-input-keyboard keyboard

react-input-with-keyboard's Introduction

React Input with Keyboard ⌨️

Preview

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

Props Type Notes
containerClassName string className of the main Input wrapper.
text string Heading of Input.
textStyles string Heading className
error bool for showing error
inputClassName string input className
placeholder string placeholder of the input
value string value of the input
size string size of the input, i.e. large default and small
onFocus function callback function for onFocus event
onBlur function callback function for onBlur event
onChange function callback function for onChange event
type string type of input, i.e text number etc.
disabled bool flag for disable the input or not.
id string id for the input.
fullKeyboard bool flag for allow full keyboard on input or just numaric keyboard
hideOnSmallDevice bool if you want to hide keyboard icon on small devices like moble and tablets
keyboardIcon React.node icon for the keyboard, which is show on right side of the input
keyboardIconColor string color of the keyboard icon
iconClassName string className for keyboard icon
keyboardKeyClassName string className for the text inside the keyboard's key
keyboardKeyContainerClassName string className for the keyboard's key

react-input-with-keyboard's People

Contributors

dependabot[bot] avatar samad324 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

rehan-sattar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.