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 🙏

© 2025 – Pkg Stats / Ryan Hefner

search-expand

v1.0.44

Published

an all purpose input multiselect with chips - includes search on the tooltip

Readme

Search Expand

Compact, animated search input that expands on focus/hover. Ships as a Web Component and a class-based API, with dynamic skin loading and CSS variables for flexible theming.

  • Package: search-expand
  • Builds: ESM/CJS via dist/index.js, UMD via dist-webpack/search-expand.js
  • Homepage: https://digitalzoomstudio.net

Features

  • Two usage modes: programmatic API or <dzs-search-expand> web component
  • Skins: default, flat, default-dark, flat-dark with dynamic loading
  • CSS variables for quick theming
  • TypeScript types included

form: skin-default

expanded: skin-default

Installation

npm install search-expand

Quick start

1) Programmatic (TypeScript/JavaScript)

import { initSearchExpand } from 'search-expand';

const host = document.getElementById('search-host') as HTMLElement;
const instance = initSearchExpand(host, {
  viewSkin: 'default',
  inputPlaceholderText: 'Filter results...',
  persistentOptions: [
    { htmlContent: 'Apple', value: 'apple', currentStatus: 'unchecked' },
    { htmlContent: 'Orange', value: 'orange', currentStatus: 'checked' },
  ],
  onSubmitSearch: (q) => console.log('Submit:', q),
});

// Note: include base CSS in your page
// <link rel="stylesheet" href="/dist-webpack/dzs-search-expand.css" />

2) Web Component

<!-- Include UMD or initialize web components in your app code -->
<dzs-search-expand
  data-skin="default"
  data-persistentOptions='[
    {"htmlContent":"Apple","value":"apple","currentStatus":"unchecked"},
    {"htmlContent":"Orange","value":"orange","currentStatus":"checked"}
  ]'>
</dzs-search-expand>

<script>
  // Optional: change skin dynamically
  // const el = document.querySelector('dzs-search-expand');
  // el.setSkin('flat-dark');
</script>

Initialize custom element (only once per page) if you import modules directly:

import { initWebComponents, configureSkinLoading } from 'search-expand';
configureSkinLoading({ basePath: '/dist/style/skins/' });
initWebComponents();

3) UMD (Browser)

<script src="dist-webpack/search-expand.js"></script>
<script>
  // Optional: configure skin path
  SearchExpand.configureSkinLoading({ basePath: '/dist/style/skins/' });

  const host = document.getElementById('search-host');
  const instance = SearchExpand.initSearchExpand(host, { viewSkin: 'default' });
  // instance.setSkin('flat');

  // Or use the web component
  SearchExpand.initWebComponents();
</script>

Options

Type: SearchExpandOptions

  • placeholderNoItemsFound?: string – Text when filtering yields no results
  • inputPlaceholderText?: string – Placeholder for the input
  • middlewareFilterResults?: any – Hook to post-process filtered results
  • viewSkin?: string – One of default | flat | default-dark | flat-dark
  • viewIsWrapping?: boolean – Control layout wrapping
  • persistentOptions?: ChipSelectorItem[] – Seed options
  • onUpdateFunction?: (items: ChipSelectorItem[]) => any – Called on updates
  • onSubmitSearch?: (query: string) => void | Promise<void> – Called on icon click or Enter

Types are exported from search-expand: SearchExpandOptions, ChipSelectorItem, currentStatusType.

Skins and styling

Available skins

  • default, flat, default-dark, flat-dark

Skin CSS files live under dist/style/skins/. If you use skins, call configureSkinLoading({ basePath: '/dist/style/skins/' }) so the runtime can lazy-load the CSS.

CSS variables

Tweak visuals via CSS custom properties:

:root {
  --search-expand-icon-size: 24px;
  --search-expand-wrapper-padding: 8px;
  --search-expand-input-font-size: 14px;
  --search-expand-color-icon: #fff;
  --search-expand-color-icon-hover: #dadada;
  --search-expand-color-wrapper-bg: #222;
  --search-expand-color-wrapper-bg-hover: var(--search-expand-color-wrapper-bg);
  --search-expand-color-text: #fff;
  --search-expand-expand-w: 180px;
}

See FLEXIBLE_STYLING.md for more strategies.

Development

# install deps
npm install

# dev build (watch)
npm run dev

# run tests
npm test

# production build (webpack + types + rollup)
npm run build

Useful demo pages:

  • src/demo.html
  • src/usage-examples.html
  • src/dynamic-skin-example.html

License

MIT OR Apache-2.0. See LICENSE.txt.

Links

  • Repo: https://github.com/raduzoom/search-expand
  • Issues: https://github.com/raduzoom/search-expand/issues