All Projects → codica2 → hv-autocomplete

codica2 / hv-autocomplete

Licence: other
Fast and flexible autocomplete library

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects
HTML
75241 projects

Projects that are alternatives of or similar to hv-autocomplete

Ngautocomplete
Light-weight autocomplete component for Angular.
Stars: ✭ 52 (+225%)
Mutual labels:  autocomplete, dropdown
Multiselect
Vue 3 multiselect component with single select, multiselect and tagging options.
Stars: ✭ 92 (+475%)
Mutual labels:  autocomplete, dropdown
Ember Select Box
🔠 A faux select box for Ember apps
Stars: ✭ 60 (+275%)
Mutual labels:  autocomplete, dropdown
choc-autocomplete
🏇 Autocomplete Component Package for Chakra UI
Stars: ✭ 286 (+1687.5%)
Mutual labels:  autocomplete, dropdown
React Selectrix
A beautiful, materialized and flexible React Select control
Stars: ✭ 166 (+937.5%)
Mutual labels:  autocomplete, dropdown
Autocomplete.js
Simple autocomplete pure vanilla Javascript library.
Stars: ✭ 3,428 (+21325%)
Mutual labels:  autocomplete, dropdown
Autocomplete
🔮 Fast and full-featured autocomplete library
Stars: ✭ 1,268 (+7825%)
Mutual labels:  autocomplete, dropdown
react-native-dropdown-autocomplete
Autocomplete input with dropdown modal component for React native. Useful for pages with multiple autocomplete's.
Stars: ✭ 97 (+506.25%)
Mutual labels:  autocomplete, dropdown
Smartmaterialspinner
The powerful android spinner library for your application
Stars: ✭ 108 (+575%)
Mutual labels:  autocomplete, dropdown
React Input Enhancements
Set of enhancements for input control
Stars: ✭ 1,375 (+8493.75%)
Mutual labels:  autocomplete, dropdown
Material Ui Superselectfield
multiselection autocomplete dropdown component for Material-UI
Stars: ✭ 260 (+1525%)
Mutual labels:  autocomplete, dropdown
react-native-autocomplete-dropdown
Dropdown Item picker with search and autocomplete (typeahead) functionality for react native
Stars: ✭ 87 (+443.75%)
Mutual labels:  autocomplete, dropdown
vue-single-select
single select dropdown with autocomplete
Stars: ✭ 43 (+168.75%)
Mutual labels:  autocomplete, dropdown
Searchtextfield
UITextField subclass with autocompletion suggestions list
Stars: ✭ 980 (+6025%)
Mutual labels:  autocomplete, dropdown
frontal
An Angular select/dropdown component
Stars: ✭ 20 (+25%)
Mutual labels:  autocomplete, dropdown
Core Components
Accessible and lightweight Javascript components
Stars: ✭ 85 (+431.25%)
Mutual labels:  autocomplete, dropdown
revodropdown
Minimalistic dropdown and auto-complete component with filtering and keyboard support
Stars: ✭ 20 (+25%)
Mutual labels:  autocomplete, dropdown
elm-selectize
selectize-like dropdown menu with autocompletion in elm
Stars: ✭ 28 (+75%)
Mutual labels:  autocomplete, dropdown
Downshift
🏎 A set of primitives to build simple, flexible, WAI-ARIA compliant React autocomplete, combobox or select dropdown components.
Stars: ✭ 10,183 (+63543.75%)
Mutual labels:  autocomplete, dropdown
Ng Select
⭐ Native angular select component
Stars: ✭ 2,781 (+17281.25%)
Mutual labels:  autocomplete, dropdown

HV-Autocomplete

HV-Autocomplete is the most flexible autoсomplete for styling and developing. You can do something more then with another autoсomplets. Firstly goal HV-Autocomplete is you may do Horizontal search results. See examples below.

var options = {
  input: document.querySelector("#input"),
  data: data,
  horizontal: true
};

new HVAutocomplete(options);

Also you can test that on your computer. For this:

  • Clone the project;
  • Start commands npm install, gulp browser-sync;

Getting started

Just download our HV-Autocomplete plugin and include to your HTML.

<!-- JS file -->
<script src="path/to/hv-autocomplete.js"></script>

Also you can use our css files. Download.

<!-- CSS file -->
<link rel="stylesheet" href="path/to/hv-autocomplete.css">

Basic

HV-Autocomplete plugin is very simple to use. Just create object HVAutocomplete and set options for it.

Example

Code

var options = {
  input: document.querySelector("#input"),
  data: data
};

new HVAutocomplete(options);

Data types

HV-Autocomplete get two data types: default, for categories.

Default

[
  {"name": "Alex", "url": "http://..."},
  {"name": "Page", "url": "http://..."},
  ...
]

For categories

{
  "category1": {
    "title": "Category 1",
    "data": [
      {
        "name": "Page Warner",
        "url": "http://..."
      },
      ... ]
  },
  "category2": {
    "title": "Category 2",
    "data": [
      {
        "name": "Golden Curtis",
        "url": "http://..."
      },
      ... ]
  },
  ...
}

Acync get data

If you want to load your asynchronous data you can pass function to option data. Function must return object of shape. See example below.

var options = {
  input: document.querySelector("#main"),
  asyncData: function(input) {
    return {
      method: "GET",
      url: "/search/data.json?query=" + input.value,
      success: function(response) {
        console.log(response);
      }
    };
  }
};

new HVAutocomplete(options);

Categories

With HV-Autocomplete you can separate your data to categories. For this use categories: true option.

Example

Code

var options = {
  input: document.querySelector("#input"),
  data: data
};

new HVAutocomplete(options);

Data type

{
  "category1": {
    "title": "Category 1",
    "data": [
      {
        "name": "Page Warner",
        "url": "http://..."
      },
      ... ]
  },
  "category2": {
    "title": "Category 2",
    "data": [
      {
        "name": "Golden Curtis",
        "url": "http://..."
      },
      ... ]
  },
  ...
}

Horizontal categories

We want that user can use HV-Autocomplete in horizontal orientation. For this simple use right data type - see above.

Code

var options = {
  input: document.querySelector("#input"),
  data: data,
  horizontal: true
};

new HVAutocomplete(options);

Search

HV-Autocomplete has two search methods for your convenience:

  • Default search
  • Global search - looking all matches after space. For this search use globalSearch: true

Example

Code

var options = {
  input: document.querySelector("#input"),
  data: data,
  globalSearch: true
};

new HVAutocomplete(options);

Styling

We took care that styling will easy, so include two options for this:

  • resultClass
  • resultStyles

resultClass

It option replase default class to your class result block and child nodes.

For example:

div.hv-result => div.your-class-result
  └── p.hv-element-no-category => div.your-class-element-no-category

resultStyles

It options set inline styles for result block.

Structure child nodes result block

Default structure

div.hv-result
  └── a.hv-element-no-category          => option

Structure with category

div.hv-result
  └── div.hv-block-category             => block if has category
        ├── h3.hv-title-category        => title category
        └── a.hv-element-with-category  => option

Event onOptionClick

This event is calling when click on option and return event, name, url, nameCategory parameters.

Example

var options = {
  input: document.querySelector("#input"),
  data: data,
  onOptionClick: function(event, name, url, nameCategory){
    console.log(name);
  }
};

new HVAutocomplete(options);

API

Options Default value Type Description
data none object See above. Required field
input none HTML element Set HTML element. Required field
maxLength 5 number Set maximum search result.
horizontal false boolean Set your autocomplete horizontal See above.
globalSearch false boolean Set type search. See above.
resultClass hv-result string Set class for result. See above.
resultStyles null object Set inline styles for result. See above.
onOptionClick null function Callback after click on option

License

hv-autocomplete is Copyright © 2015-2018 Codica. It is released under the MIT License.

About Codica

Codica logo

We love open source software! See our other projects or hire us to design, develop, and grow your product.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].