New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

html-autocomplete

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-autocomplete

Stencil Component Starter

latest
Source
npmnpm
Version
0.2.2
Version published
Weekly downloads
14
-71.43%
Maintainers
1
Weekly downloads
 
Created
Source

HTML Autocomplete

A very light weight html/javascript autocomplete component. This component was built using StencilJs.

Support

This component works in pure HTML pages regardless of the framework you are using.

##Demo Click here to view demo..

Basic Usage

###HTML Import the javascript file the head tag of the page.

<head>
  <script type="module" src="https://unpkg.com/html-autocomplete@[version]/dist/html-autocomplete/html-autocomplete.esm.js"></script>
  <script nomodule="" src="https://unpkg.com/html-autocomplete@[version]/dist/html-autocomplete/html-autocomplete.js"></script>	
  ...
</head>

Add the autocomplete tag

<!--where suggestions is the list of your objects-->
<html-autocomplete placeholder="Search" mode="material" suggestions="suggestions" (itemSelected)="fuction($event)">
</html-autocomplate>

###NPM

Installation

npm i html-autocomplete --save

####Import component In you main file, add the following lines

import { defineCustomElements } from 'html-autocomplete/loader';
...

defineCustomElements(window);

Add the autocomplete tag

<!--where suggestions is the list of your objects-->
<html-autocomplete placeholder="Search" mode="material" suggestions="suggestions" (itemSelected)="fuction($event)">
</html-autocomplate>

####Angular/Ionic Only

@NgModule({
  declarations: [
  ...
  ],
  imports: [
    ...
  ],
  providers: [
    ...
  ],
  schemas: [CUSTOM_ELEMENTS_SCHEMA], // Add this line
  bootstrap: [AppComponent]
})

Input Properties

NameTypeDefaultDescription
suggestionsany[]nullList to search
labelFieldstring'name'Label property
idFieldstring'id'Id property
placeholderstring'Search'Placeholder
valuestring''Original value of input
modestring'material'mode (material or bootstrap
readonlybooleanfalseDisable component
imagePathFieldstringnullThe field of the image path. if this field is filled, images will appear at the start of each item.
directionstring'ltr'direction (ltr or rtl)

Output Properties

NameTypeDescription
itemSelectedEventEmitterItem Selected

Css Variables

NamevalueDescription
--width100%Width of the input
--color#000000Color inside input
--label-color#000000Label Color (material)
--label-color-focus#2196f3Label Color when focus (material)
--border-color#c6c6c6Color of border
--border-color-focus#2196f3Color of border on focus
--font-size18pxFont size
--label-font-size16pxLabel font size (material)
--label-font-size-focus12pxlabel font size focus(material)
--margin-top16pxTop margin
--margin-bottom16pxBottom margin
--margin-left16pxLeft margin
--margin-right16pxRight margin
--suggestions-background#fffBackground of suggestions
--suggestions-color#000000Text color of suggestions
--image-width30pxWidth of the images
--image-height30pxHeight of the images

Thanks for reading

Keywords

html

FAQs

Package last updated on 21 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts