LiveTyping / smart-input

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ReactSmartInput

React component – an input with dropdown suggestion to build SQL-like queries. Uses PEG.js to parse and get expectations and errors. You can fork and import your own grammar. This is an initial version more flexibility and features are comming.

Installation

You have to download it manually or install from GitHub. NPM release is comming soon.

Usage

import SmartInput from 'react-smart-input'

then

<SmartInput applyKey="Tab" suggestions={{ identifier: ['id', 'name', 'age'] }} placeholder="SQL-like query" errors={true}/>

You can see usage example at /example.

Props

name type default description
suggestions Object Object to describe suggestions that are not in PEG. `{ identifier: ['id', 'name', 'age'] }`
applyKey String Tab Button to apply selected suggestion from dropdown
placeholder String Placeholder for input
errors Boolen false Toggles errors block

Development

Install dependencies:

$ npm install

Run the example app at http://localhost:8080:

$ npm run example

No tests yet, but to run tests in Chrome using karma:

$ npm test

Run tests and watch for code changes:

$ npm test -- --watch

Lint src and test files:

$ npm run lint

Generate UMD output in the lib folder:

$ npm run build

About


Languages

Language:JavaScript 90.7%Language:CSS 6.5%Language:HTML 2.8%