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

@aniruddha1806/autocomplete

v1.3.4

Published

Advanced autocomplete component

Readme

React Autocomplete Component

A lightweight, customizable autocomplete component for React applications with zero dependencies. This component provides a searchable dropdown with various animation options, styling customizations, and both basic and advanced modes.

Installation

npm install @aniruddha1806/autocomplete

Features

  • 🔍 Simple search functionality with filtering options
  • 🎨 Fully customizable styling
  • ✨ Built-in animations with multiple presets
  • 🌙 Dark mode support
  • 🧩 Basic and advanced display modes
  • 🔄 Zero external dependencies

Usage

import { Autocomplete } from '@aniruddha1806/autocomplete';

function App() {
  const fruits = [
    "Apple", "Banana", "Cherry", "Date", "Elderberry",
    "Fig", "Grape", "Honeydew", "Kiwi", "Lemon"
  ];

  const handleSelect = (word) => {
    console.log(`Selected: \${word}`);
  };

  return (
    <Autocomplete 
      words={fruits}
      onSelect={handleSelect}
      placeholder="Search fruits..."
    />
  );
}

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | words | string[] | [] | Array of strings to be used as autocomplete options | | mode | "basic" \\| "advanced" | "basic" | Display mode of the component | | strictMode | boolean | false | When true, only shows results that start with the input value | | className | string | "" | Additional class name for the root element | | inputClassName | string | "" | Additional class name for the input element | | dropdownClassName | string | "" | Additional class name for the dropdown container | | itemClassName | string | "" | Additional class name for dropdown items | | inputIcon | ReactNode | <SearchIcon /> | Custom icon for the input field | | itemIcon | ReactNode | undefined | Icon to display next to items (only in advanced mode) | | placeholder | string | "Search..." | Placeholder text for the input | | animationPreset | "fade" \\| "slide" \\| "scale" |" fade" | Animation style for the dropdown | | animated | boolean | true | Enable/disable animations | | onSelect | (word: string) => void | undefined | Callback function when an item is selected |

Examples

Basic Mode

The default mode with simple styling:

import { Autocomplete } from '@aniruddha1806/autocomplete';

function BasicExample() {
  const countries = [
    "United States", "Canada", "United Kingdom", "Australia", 
    "Germany", "France", "Japan", "Brazil", "India", "China"
  ];

  return (
    <Autocomplete 
      words={countries}
      placeholder="Search countries..."
    />
  );
}

Advanced Mode

Advanced mode with item icons:

import { Autocomplete } from '@aniruddha1806/autocomplete';
import { Globe } from 'lucide-react'; // Example icon library

function AdvancedExample() {
  const countries = [
    "United States", "Canada", "United Kingdom", "Australia", 
    "Germany", "France", "Japan", "Brazil", "India", "China"
  ];

  return (
    <Autocomplete 
      words={countries}
      mode="advanced"
      itemIcon={<Globe size={16} />}
      placeholder="Search countries..."
      animationPreset="slide"
    />
  );
}

With Strict Mode

Only show results that start with the input value:

import { Autocomplete } from '@aniruddha1806/autocomplete';

function StrictModeExample() {
  const programmingLanguages = [
    "JavaScript", "TypeScript", "Python", "Java", "C#", 
    "C++", "PHP", "Ruby", "Swift", "Go"
  ];

  return (
    <Autocomplete 
      words={programmingLanguages}
      strictMode={true}
      placeholder="Search languages..."
      animationPreset="scale"
    />
  );
}

With Animation Presets

Different animation styles for the dropdown:

import { Autocomplete } from '@aniruddha1806/autocomplete';

function AnimationExample() {
  const colors = [
    "Red", "Blue", "Green", "Yellow", "Purple", 
    "Orange", "Pink", "Cyan", "Magenta", "Lime"
  ];

  return (
    <div>
      {/* Fade animation */}
      <Autocomplete 
        words={colors}
        animationPreset="fade"
        placeholder="Fade animation..."
      />
      
      {/* Slide animation */}
      <Autocomplete 
        words={colors}
        animationPreset="slide"
        placeholder="Slide animation..."
      />
      
      {/* Scale animation */}
      <Autocomplete 
        words={colors}
        animationPreset="scale"
        placeholder="Scale animation..."
      />
      
      {/* No animation */}
      <Autocomplete 
        words={colors}
        animated={false}
        placeholder="No animation..."
      />
    </div>
  );
}

With Custom Icons

Using custom icons for input and items:

import { Autocomplete } from '@aniruddha1806/autocomplete';
import { User, Star } from 'lucide-react';

function CustomIconExample() {
  const users = [
    "John Doe", "Jane Smith", "Bob Johnson", "Alice Brown", 
    "Charlie Wilson", "Diana Davis", "Eve Miller", "Frank Garcia"
  ];

  return (
    <Autocomplete 
      words={users}
      mode="advanced"
      inputIcon={<User size={16} />}
      itemIcon={<Star size={14} />}
      placeholder="Search users..."
    />
  );
}

TypeScript Support

The component is written in TypeScript and includes full type definitions:

import { Autocomplete, AutocompleteProps } from '@aniruddha1806/autocomplete';

interface MyComponentProps {
  searchOptions: string[];
}

const MyComponent: React.FC<MyComponentProps> = ({ searchOptions }) => {
  const handleSelection = (selectedWord: string): void => {
    console.log('Selected:', selectedWord);
  };

  return (
    <Autocomplete
      words={searchOptions}
      onSelect={handleSelection}
      mode="advanced"
      strictMode={true}
    />
  );
};