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

react-ai-finder

v1.0.1

Published

A plug-and-play React component for AI-enhanced search with local fuzzy search and cloud AI API support

Readme

React AI Finder

A plug-and-play React component for AI-enhanced search with local fuzzy search and cloud AI API support.

Features

  • 🚀 Plug-and-play: Just import and use
  • 🔍 AI-enhanced matching: Local fuzzy search or cloud AI APIs
  • 💡 Autocomplete & Suggestions: Real-time search as you type
  • ⌨️ Keyboard navigation: Arrow keys and enter support
  • 🎨 Custom rendering: Define how results look
  • 🌐 Multiple data sources: Works with datasets or API endpoints

Installation

npm install react-ai-finder

Usage

Basic Usage

import { AISearch } from "react-ai-finder";
import "react-ai-finder/dist/style.css";

const App = () => {
  const data = [
    { id: 1, title: "Apple", description: "A red fruit" },
    { id: 2, title: "Banana", description: "A yellow fruit" },
    { id: 3, title: "Orange", description: "An orange fruit" },
  ];

  const handleSelect = (result) => {
    console.log("Selected:", result);
  };

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

Local Fuzzy Search

import { AISearch } from "react-ai-finder";

const App = () => {
  const data = [
    { id: 1, title: "Apple", description: "A red fruit" },
    { id: 2, title: "Banana", description: "A yellow fruit" },
  ];

  return <AISearch data={data} searchType="local" />;
};

Cloud AI Search

import { AISearch } from "react-ai-finder";

const App = () => {
  const data = [
    { id: 1, title: "Apple", description: "A red fruit" },
    { id: 2, title: "Banana", description: "A yellow fruit" },
  ];

  return (
    <AISearch
      data={data}
      searchType="cloud"
      cloudProvider="openai"
      apiKey="your-openai-api-key"
    />
  );
};

Custom Rendering

import { AISearch } from "react-ai-finder";

const App = () => {
  const data = [
    { id: 1, title: "Apple", description: "A red fruit" },
    { id: 2, title: "Banana", description: "A yellow fruit" },
  ];

  const renderCustomItem = (result) => (
    <div style={{ padding: "10px", border: "1px solid #ccc" }}>
      <h3>{result.title}</h3>
      <p>{result.description}</p>
    </div>
  );

  return <AISearch data={data} renderItem={renderCustomItem} />;
};

Styling Customization

The component can be customized in multiple ways:

1. CSS Variables Theme

You can customize the component's theme using CSS variables:

import { AISearch } from "react-ai-finder";
import "react-ai-finder/dist/style.css";

const App = () => {
  const customTheme = {
    primaryColor: "#ff6b6b",
    secondaryColor: "#4ecdc4",
    backgroundColor: "#f8f9fa",
    borderColor: "#dee2e6",
    textColor: "#343a40",
    borderRadius: "12px",
  };

  return <AISearch data={data} theme={customTheme} />;
};

Available theme properties:

  • primaryColor: Main color for focus states and highlights
  • secondaryColor: Color for secondary text and elements
  • backgroundColor: Background color for input and results
  • borderColor: Border color for input and results
  • textColor: Main text color
  • borderRadius: Border radius for rounded corners

2. Custom CSS Classes

For more advanced customization, you can provide custom CSS classes:

<AISearch
  data={data}
  containerClassName="my-custom-container"
  inputClassName="my-custom-input"
  resultsClassName="my-custom-results"
  resultItemClassName="my-custom-item"
  loadingClassName="my-custom-loading"
/>

Example CSS:

.my-custom-container {
  max-width: 100%;
}

.my-custom-input {
  background-color: #fff;
  border: 2px solid #ddd;
  border-radius: 25px;
  padding: 15px 20px;
  font-size: 18px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.my-custom-input:focus {
  border-color: #ff6b6b;
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.25);
}

.my-custom-results {
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.my-custom-item {
  padding: 15px 20px;
  border-bottom: 1px solid #eee;
  transition: all 0.2s ease;
}

.my-custom-item:hover {
  background-color: #fff9f9;
  transform: translateX(5px);
}

API

Props

| Prop | Type | Default | Description | | --------------------- | ---------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------- | | data | SearchResult[] or string | required | Array of search items or API endpoint URL | | apiKey | string | undefined | API key for cloud providers | | searchType | 'local' or 'cloud' | 'local' | Search type | | cloudProvider | 'openai' or 'cohere' | 'openai' | Cloud provider for AI search | | placeholder | string | 'Search...' | Input placeholder text | | onSelect | function | undefined | Callback when item is selected | | renderItem | function | undefined | Custom renderer for results | | debounceMs | number | 300 | Debounce time in milliseconds | | containerClassName | string | undefined | Custom class name for the container | | inputClassName | string | undefined | Custom class name for the input element | | resultsClassName | string | undefined | Custom class name for the results container | | resultItemClassName | string | undefined | Custom class name for result items | | loadingClassName | string | undefined | Custom class name for the loading indicator | | theme | object | undefined | Theme customization object with properties: primaryColor, secondaryColor, backgroundColor, borderColor, textColor, borderRadius |

Types

interface SearchResult {
  id: string | number;
  title: string;
  description?: string;
  url?: string;
  [key: string]: any;
}

Development

Building

npm run build

Development

npm run dev

Testing

npm run test

License

MIT