Giter Site home page Giter Site logo

shra1dhar / autocomplete-ts Goto Github PK

View Code? Open in Web Editor NEW
10.0 2.0 1.0 1.85 MB

Advanced React based tab-able autocomplete library. Similar to Google's autocomplete.

License: MIT License

CSS 19.07% JavaScript 35.88% TypeScript 45.05%
autocomplete autocomplete-search google reactjs javascript autosuggestion auto-suggest typesc

autocomplete-ts's Introduction

Autocomplete-ts

Advanced React based autocomplete library. Similar to Google's autocomplete.

License: MIT npm version Build Status PRs: Welcome

Demo GIF

Features

  • Lightweight
  • Supports React
  • Dependency-free
  • Support for typescript
  • Easy Configurable and use

Core Features

  • Quick auto suggestion (under 5 ms for a set of 4000 keywords)
  • Adding server generated suggestions (NLP based model etc.)
  • WAI ARIA support for accessibility (adding more)
  • Strict Type checks and declarations for typescript

Quick Start

Installation

Download and install via npm package manager

npm i autocomplete-ts
// import like this
import AutoComplete from  'autocomplete-ts';

// or like this
const autoComplete = require('autocomplete-ts');
const countries = ['Australia', 'China', 'Denmark', 'India', 'Russia', 'South Africa', 'USA'];

// render method
render() {
	return <AutoComplete  suggestList={countries}  />
}

Add this css to your project:

:root {
	--ac-ts-input-height:  25px;
	--ac-ts-input-width:  300px;
	--ac-ts-input-fontSize:  .9em;
	--ac-ts-input-suggest-color:  #bbb;
	--ac-ts-input-suggest-bgColor:  #fff;
	--ac-ts-input-color:  #333;
	--ac-ts-input-active-bgColor:  #fff;
	--ac-ts-input-disabled-bgColor:  #ccc;
	--ac-ts-input-border-focus:  inherit;
	--ac-ts-input-padding:  5px;
	--ac-ts-input-borderRadius:  5px;
	--ac-ts-input-border:  1px  solid  #ccc;
}

.autocomplete--fill-input  .autocomplete--input-suggestion {
	background-color:  var(--ac-ts-input-suggest-bgColor);
	position:  absolute;
	z-index:  -10;
	color:  var(--ac-ts-input-suggest-color);
}

.autocomplete--fill-input  .autocomplete--input-suggestion:disabled {
	background-color:  var(--ac-ts-input-disabled-bgColor);
}

.autocomplete--fill-input  .autocomplete--input-active {
	background-color:  transparent;
	color:  var(--ac-ts-input-color);
	z-index:  10;
}

.autocomplete--fill-input  .autocomplete--input-active:disabled {
	background-color:  transparent;
}

.autocomplete--fill-input  .autocomplete--input-active:focus {
	border-color:  var(--ac-ts-input-border-focus);
}

.autocomplete--fill-input  .autocomplete--input-suggestion,
.autocomplete--fill-input  .autocomplete--input-active {
	padding:  var(--ac-ts-input-padding);
	border:  var(--ac-ts-input-border);
	height:  var(--ac-ts-input-height);
	width:  var(--ac-ts-input-width);
	font-size:  var(--ac-ts-input-fontSize);
	border-radius:  var(--ac-ts-input-borderRadius);
}

Contributing

I've just started out with this library and plan to incrementally add tests and other functionality which the community will ask for. I'll be spending the next few weeks solely to this project to achieve that. Hard Core mode on ๐Ÿ”ฅ

Tests would be based on Jest and can be run with npm run test

To build the library run npm run build

Further

I'll be dedicating a website with an indepth docs and code sandboxes to use this library. In the meantine, feel free to raise bugs or request for feature/enhancements. Please follow proper guidelines to do so. Cheers ๐Ÿ˜

autocomplete-ts's People

Contributors

shra1dhar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

arnavraina

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.