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 🙏

© 2026 – Pkg Stats / Ryan Hefner

web-complete

v1.3.2

Published

A lightweight, dependency-free, styleable autocomplete web component

Readme

Built With Stencil Published on webcomponents.org Build Status

web-complete is a lightweight, dependency-free, styleable autocomplete web component.

Installation

Script tag

<script type="module" src="https://unpkg.com/web-complete"></script>
<script nomodule src="https://unpkg.com/web-complete/dist/web-complete/web-complete.js"></script>

Node Module

  • Install via npm: npm install web-complete --save
  • Add script to html: <script src='node_modules/web-complete/dist/web-complete.js'></script>
  • Or import as JS module: import 'web-complete';

Framework integration

For integration with different frameworks the stencil docs should be consulted.

Using this component

Add the component to your html:

<web-complete id="my-web-complete"></web-complete>

Add some javascript for additional configuration:

const webcomplete = document.querySelector('#my-web-complete');

// change css classes for styling
webcomplete.cssClasses = {
  "wrapper": "dropdown",
  "input": "form-control",
  "suggestions": "dropdown-menu show",
  "suggestion": "dropdown-item",
  "active": "active"
};

// add an async suggestion generator
webcomplete.suggestionGenerator = function(text) {
  return new Promise(function(resolve, reject) {
    // generate suggestions with input text
    // e.g. by using http fetch 
  });
};

// listen to selected/unselected events
webcomplete.addEventListener('selected', function(e) {
  // suggestion selected (e.detail)
});
webcomplete.addEventListener('unselected', function(e) {
  // suggestion unselected (e.detail)
});

A full example with Bootstrap 4 Dropdown theming can be found here.

Component API

Properties

| Property | Attribute | Description | Type | Default | | -------------------------- | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | | clearOnUnselectedClosing | clear-on-unselected-closing | If no value is selected, clear the input and emit unselected, if false, the value will not be cleared (usefull for suggesting values on a free text search) | boolean | true | | cssClasses | -- | The class names, which should be set on the rendered html elements | { wrapper: string; input: string; suggestions: string; suggestion: string; active: string; } | { wrapper: "", input: "", suggestions: "suggestions", suggestion: "suggestion", active: "active" } | | disabled | disabled | Enable/Disable the input field | boolean | false | | inputId | input-id | id of the input field | string | "" | | inputmode | inputmode | A hint to the browser for which keyboard to display. Possible values: "none", "text", "tel", "url", "email", "numeric", "decimal", and "search". | "decimal" \| "email" \| "none" \| "numeric" \| "search" \| "tel" \| "text" \| "url" | undefined | | maxSuggestions | max-suggestions | The maximally shown suggestions in the list | number | 5 | | minInput | min-input | The minimum input size for generating suggestions | number | 0 | | placeholder | placeholder | The placeholder for the input field | string | "" | | required | required | Form validation: is the form input required | boolean | false | | suggestionGenerator | -- | Async suggestion generator: text is the displayed for users in the form after selection (if no suggesion also as suggesion) value is the actual value of the form field optional suggesion if the autocomplete suggestion item should be formatted differently than text | (text: string) => Promise<{ text: string; value: string; suggestion?: string; }[]> | undefined | | text | text | The text is displayed by the form field for users | string | "" | | value | value | The actual value of the form field | string | "" | | emptySuggestionTime | empty-suggestion-time | Milliseconds before diplaying autocomplete, even if it's empty or nothing is type in the input. It allow to inspire users for example. Use -1 to disable it. | number | -1 |

Events

| Event | Description | Type | | ------------ | -------------------------------------------------- | ------------------ | | selected | Emitted when an item from suggestions was selected | CustomEvent<any> | | unselected | Emitted when item was cleared/unselected | CustomEvent<any> |

Methods

clear() => Promise<void>

Clears the form field (suggestions and selection)

Returns

Type: Promise<void>

getText() => Promise<string>

Returns the text of the selected item

Returns

Type: Promise<string>

getValue() => Promise<string>

Returns the value of the selected item

Returns

Type: Promise<string>

Developer

npm i            install dependencies
npm start        start local development 
npm run build    build component for production
npm test         run e2e tests