Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/avishwakarma/preact-typeahead

A TypeHead component for Preact
https://github.com/avishwakarma/preact-typeahead

Last synced: about 2 months ago
JSON representation

A TypeHead component for Preact

Awesome Lists containing this project

README

        

# TypeAhead

A TypeAhead Component for Preact

### Setup

Clone the repo

```
git clone https://github.com/ashokvishwakarma/preact-typehead.git
```

install the packages

```
npm install
````

Run development server

```
npm start
```

Build component

```
npm run build
```

Test

```
npm run test
```

### TypeAhead Props

Available props and their default values

|Prop|Details|Default Value|
|----|-------|------------:|
|url|URL to fetch data from the server|`null`|
|params|Configuration object to api check example folder for more details| Check the example|
|dataKey|Key in which the data is available|`data`|
|data|Data for typeahead|`null`|
|suggestAfter |Chars to wait till the suggestions|3|
|maxItem|Maximum items to be selected|5|
|displayKey|Key to display in chips or input|`title`|
|onInput|onInput callback| function |
|onSelect|onSelect callback| function |
|hilightTerm|Highlight the matched term| `false` |
|duplicate|Allow selected item in suggestion| `false` |
|multiple|Select multiple items| `false` |
|itemBuilder|function to custom html for suggested items | NA |