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 🙏

© 2024 – Pkg Stats / Ryan Hefner

instantsearch.js

v4.67.0

Published

InstantSearch.js is a JavaScript library for building performant and instant search experiences with Algolia.

Downloads

1,405,200

Readme


InstantSearch.js is a vanilla JavaScript library that lets you create an instant-search result experience using Algolia’s search API. It is part of the InstantSearch family:

InstantSearch.js | React InstantSearch | Vue InstantSearch | Angular InstantSearch | React InstantSearch Native | InstantSearch Android | InstantSearch iOS

Why

You should be using InstantSearch if you want to:

  • Design search experiences with best practices
  • Customize your components at will
  • Remain independent from external frameworks

Getting started

Using InstantSearch.js is as simple as adding this JavaScript code to your page:

// 1. Instantiate the search
const search = instantsearch({
  indexName: 'instant_search',
  searchClient: algoliasearch('latency', '6be0576ff61c053d5f9a3225e2a90f76'),
});

search.addWidgets([
  // 2. Create an interactive search box
  instantsearch.widgets.searchBox({
    container: '#searchbox',
    placeholder: 'Search for products',
  }),

  // 3. Plug the search results into the product container
  instantsearch.widgets.hits({
    container: '#products',
    templates: {
      item: (hit, { html, components }) =>
        html`
          <h3>${components.Highlight({ attribute: 'name', hit })}</h3>
          <p>${components.Snippet({ attribute: 'description', hit })}</p>
        `,
    },
  }),

  // 4. Make the brands refinable
  instantsearch.widgets.refinementList({
    container: '#brand',
    attribute: 'brand',
  }),
]);

// 5. Start the search!
search.start();

To learn more about the library, follow the getting started guide or check how to add it to your own project.

Installation

npm install instantsearch.js algoliasearch
# or
yarn add instantsearch.js algoliasearch

TypeScript users

To use InstantSearch.js in a TypeScript environment, depending on your algoliasearch version, you need to import different types.

You still need to import these types even if you don't use InstantSearch.js with algoliasearch.

algoliasearch v4.x

This version uses types provided by both algoliasearch and @algolia/client-search.

yarn add algoliasearch@4 @algolia/client-search

algoliasearch v3.x

yarn add @types/algoliasearch@3

v3.x is deprecated and will soon no longer be supported.

Documentation

The documentation is available on the Algolia website.

Demos

| E-commerce | Media | Travel | | --- | --- | --- | | | | |

See more demos on the website.

Playground

You can get to know InstantSearch.js on this playground.

Start by adding widgets and tweaking the display. Once you feel familiar with the library, we recommend following the getting started guide.

Browser support

We support the last two versions of major browsers (Chrome, Edge, Firefox, Safari).

Please refer to the browser support section in the documentation to use InstantSearch.js on other browsers.

Troubleshooting

Encountering an issue? Before reaching out to support, we recommend heading to our FAQ where you will find answers for the most common issues and gotchas with the library.

Contributing

We welcome all contributors, from casual to regular 💙

To start contributing to code, you need to:

  1. Fork the project
  2. Clone the repository
  3. Install the dependencies: yarn
  4. Run the development mode: yarn storybook
  5. Open the stories

Please read our contribution process to learn more.

License

InstantSearch.js is MIT licensed.