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

@josros/autocomplete

v0.5.0

Published

A basic auto-completion Web Component.

Readme

josros-autocomplete

A basic auto-completion Web Component.

Demo

Installation

  1. Install dependency

    npm install @josros/autocomplete --save

  2. ES6 import

    import "@josros/autocomplete";

  3. Use the component

    <josros-autocomplete
        label='Your label'
    ></josros-autocomplete>

Usage

Set data

Here is how you can set the items property on a normal website:

document.querySelectorAll('josros-autocomplete').forEach(element => {
    element.setAttribute('items', JSON.stringify([{'text': 'Hello'}, {'text': 'Hallo'}, {'text': 'Hola'}, {'text': 'Bonjour'}]));
})

Component Api

Properties

| Attribute | Description | Type | Default | | --------------- | ------------------------------------------------------------------------------------ | --------- | ------- | | value | Initial value of the text field | String | "" | | label | Label of the text field | String | "" | | items | Auto completion items (suggestions) | [{ text!: string, value?: any}] | [] | | loading | Toggles loading state | boolean | false | | max-suggestion-items | Max. elements suggested | number | 15 | | no-border | Disables borders around input text field | boolean | false | | outline | Disables outline around input text field | boolean | false | | highlight-bottom-line | Enables bottom line highlighting around input text field on focus (disabled if noBorder is defined) | boolean | false |

Events

| Event | Description | | ------------ | --------------------------------------------------------------------- | | selected | Fired as soon as a suggestion is selected (via keyboard or mouse) | | autocomplete-input | Fires on text changes | | changed | Fires on internal input change event | | blurred | Fires on internal input blur event | | focussed | Fires on internal input focus event | | enter-pressed | Fire as soon as enter is pressed on the input |

CSS Custom Properties

| Name | Description | Default | | ----------------------------- | -------------------------------- | -------------------------------- | | --josros-autocomplete--font-size | The font-size of the host | 1rem | --primary-color | Primary color | #000 | --background-color | Background color | transparent | --foreground-color | Foreground color | rgba(0, 0, 0) | --item-background-color | Background color of the suggestion items | lightgrey | --item-focus-color | Background color of the suggestion items shown when input gets focus | #e0e0e0 | --loader-color | Color of the loading animation | rgb(0, 136, 204) | --font-size | Font size of the input text | 1.6em | --padding | Padding of the input | 1.2em 0em 0.4em 0em | --padding--label | Padding of the label above the input | 0em | --padding--suggestion | Padding of a single suggestion box | 1.5em | --margin--suggestions | Margin of the whole suggestion container | 0em | --max-height--suggestions| Max height of the suggestion container | 20em | --input-default-border | Border around the input text field | none | --input-default-border-bottom | Bottom border around the input text field | 0.1em solid var(--primary-color, grey)

Execution

# production build
npm run build

# run dev server at http://localhost:3000
npm run serve

# unit tests
npm run test:unit

# e2e tests
npm run test:e2e

# Lintting
npm run lint

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

BSD 3-Clause License