npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

html-autocomplete

v0.2.2

Published

Stencil Component Starter

Downloads

391

Readme

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

| Name | Type | Default | Description | | --------------|:-------------:| ---------:|------------------------:| | suggestions | any[] | null |List to search | | labelField | string | 'name' |Label property | | idField | string | 'id' |Id property | | placeholder | string | 'Search' |Placeholder | | value | string | '' |Original value of input | | mode | string | 'material' |mode (material or bootstrap | | readonly | boolean | false |Disable component | | imagePathField | string | null |The field of the image path. if this field is filled, images will appear at the start of each item.| | direction | string | 'ltr' |direction (ltr or rtl)|

Output Properties

| Name | Type | Description | | --------------|:-------------:|------------------------:| | itemSelected | EventEmitter |Item Selected |

Css Variables

| Name | value | Description | | -------------- |:-------------:|------------------------:| | --width | 100% |Width of the input | | --color | #000000 |Color inside input | | --label-color | #000000 |Label Color (material) | | --label-color-focus | #2196f3 |Label Color when focus (material) | | --border-color | #c6c6c6 |Color of border | | --border-color-focus | #2196f3 |Color of border on focus | | --font-size | 18px |Font size | | --label-font-size | 16px |Label font size (material) | | --label-font-size-focus| 12px |label font size focus(material) | | --margin-top | 16px |Top margin | | --margin-bottom | 16px |Bottom margin | | --margin-left | 16px |Left margin | | --margin-right | 16px |Right margin | | --suggestions-background | #fff |Background of suggestions | | --suggestions-color | #000000 |Text color of suggestions | | --image-width | 30px |Width of the images | | --image-height | 30px |Height of the images |

Thanks for reading