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

autosuggestion-kit

v1.0.4

Published

A lightweight, accessible React autosuggestion component with static and async suggestions, keyboard navigation, search history, and customizable styling.

Downloads

18

Readme

AutoSuggestion Kit

npm version License: ISC

A powerful, lightweight, and fully customizable React autosuggestion/autocomplete component that delivers dynamic search experiences with blazing-fast performance. With support for static and asynchronous data sources, advanced keyboard navigation, and built-in search history using localStorage, AutoSuggestion Kit enables intuitive and highly accessible search bars, dropdowns, and typeahead features―all with zero external dependencies.

  • Static and async suggestions — use local arrays or fetch suggestions dynamically

  • Keyboard navigation — arrow up/down to navigate, enter to select, escape to close

  • Search history — remembers recent selections automatically via localStorage

  • Debouncing — delays user input processing to reduce unnecessary fetches

  • Caching — caches previous async queries for faster repeated results

  • Customizable styling and rendering — easily adapt to your project’s needs

🚀 Live Demo

Live Demo

Try out AutoSuggestion Kit in action! See interactive examples, customizations, and API usage.

Basic Usage with Static Suggestions

import React from "react"
import { AutoSuggestion, SuggestionItem } from "autosuggestion-kit"

const fruits: SuggestionItem[] = [
  { id: 1, label: "Apple", metadata: { category: "Fruit" } },
  { id: 2, label: "Banana", metadata: { category: "Fruit" } },
  { id: 3, label: "Cherry", metadata: { category: "Fruit" } },
  // ...more items
]

const trendingSearches: SuggestionItem[] = [
  { id: "trending-1", label: "Popular searches", metadata: { category: "Trending" } },
  { id: "trending-2", label: "Latest updates", metadata: { category: "Trending" } },
]

export default function App() {
  const handleSelect = (item: SuggestionItem) => {
    console.log("Selected:", item)
  }

  return (
    <AutoSuggestion
      suggestions={fruits}
      defaultSuggestions={trendingSearches}
      showDefaultOnFocus={true}
      enableHistory={true}
      historyKey="fruits-demo"
      placeholder="Search for fruits..."
      onSelect={handleSelect}
    />
  )
}

Async Suggestions Example

import React from "react"
import { AutoSuggestion, SuggestionItem } from "autosuggestion-kit"

// Simulate async API fetch with delay
const fetchSuggestions = async (query: string): Promise<SuggestionItem[]> => {
  await new Promise((resolve) => setTimeout(resolve, 300))

  // Your real fetch would go here
  const fruits = [
    { id: 1, label: "Apple" },
    { id: 2, label: "Banana" },
    { id: 3, label: "Cherry" },
  ]

  return fruits.filter(fruit =>
    fruit.label.toLowerCase().includes(query.toLowerCase())
  )
}

export default function AsyncSearch() {
  return (
    <AutoSuggestion
      fetchSuggestions={fetchSuggestions}
      enableHistory={true}
      historyKey="async-demo"
      placeholder="Search fruits (async)..."
      debounceMs={300}
      minQueryLength={1}
      onSelect={(item) => alert(`Selected: ${item.label}`)}
    />
  )
}

Main Props

| Prop / Function | Purpose / Description | Example Value | |----------------------|-------------------------------------------------------------------|-----------------------------------| | suggestions | Static array of suggestion items to display | [ { id: 1, label: "Apple" }, ... ] | | fetchSuggestions | Async function to fetch suggestions based on input query | async (query) => [...] | | defaultSuggestions | Suggestions shown when input is empty or on focus | [ { id: "t1", label: "Popular" }] | | showDefaultOnFocus | Whether to show defaultSuggestions when input is focused and empty | true | | enableHistory | Enables saving and showing recently selected items | true | | historyKey | Key string to store history in localStorage | "fruits-demo" | | debounceMs | Debounce delay in milliseconds for async fetch | 300 | | minQueryLength | Minimum characters required to trigger async fetch or filtering | 1 | | placeholder | Placeholder text for the search input | "Search fruits..." | | onSelect | Callback called when user selects a suggestion | (item) => console.log(item) | | onChange | Callback called on input value change | (value) => console.log(value) |

Feedback

If you have any feedback, please reach out to us at [email protected]