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

@yohns/yoselect

v0.1.2

Published

A customizable select component with search, multiple selection, image support, and option creation capabilities built on top of PicoCSS with Vanilla JavaScript

Readme

YoSelect

YoSelect is a customizable select component that enhances the native HTML select element with features like searching, multiple selection, image support, and the ability to create new options.

Installation

npm install @yohns/yoselect
  1. Include the CSS and JS files in your HTML:
<link rel="stylesheet" href="yoSelect.css">
<script src="yoSelect.js"></script>

Basic Usage

<select class="yoSelect">
<option value="">Select an option...</option>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
</select>
<script>
const select = new YoSelect(document.querySelector('.yoSelect'));
</script>

Features & Options

Configuration Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | search | boolean | false | Enables search functionality | | creatable | boolean | false | Allows creating new options | | clearable | boolean | false | Adds ability to clear selection | | searchPlaceholder | string | 'Search...' | Placeholder text for search input | | noResultsPlaceholder | string | 'No results found' | Text shown when no options match search | | addOptionPlaceholder | string | 'Press Enter to add "[term]"' | Text shown when creating new option | | classTag | string | '' | Custom CSS class for selected tags in multiple mode | | placeholder | string | '' | Default placeholder text when no option is selected |

HTML Attributes

You can configure YoSelect using either JavaScript options or data attributes:

<select
class="yoSelect"
data-yo-search="true"
data-yo-clearable="true"
data-yo-creatable="true">

Image Support

Add images to options using the data-yo-img attribute:

<option value="us" data-yo-img="path/to/image.png">United States</option>

Multiple Selection

Enable multiple selection using the multiple attribute:

<select class="yoSelect" multiple>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
</select>

Searchable Select

Enable search functionality:

<select class="yoSelect" data-yo-search="true">
<!-- options -->
</select>
<!-- or via JavaScript -->
<script>
new YoSelect(element, {
search: true,
searchPlaceholder: 'Custom search placeholder...',
noResultsPlaceholder: 'Custom no results message'
});
</script>

Creatable Options

Allow users to create new options:

<select class="yoSelect" data-yo-creatable="true">
<!-- options -->
</select>
<!-- or via JavaScript -->
<script>
new YoSelect(element, {
creatable: true,
addOptionPlaceholder: 'Press Enter to create "[term]"'
});
</script>

Clearable Selection

Enable clearing of selection:

<select class="yoSelect" data-yo-clearable="true">
<!-- options -->
</select>

Placeholder Text

Set placeholder text in three ways:

  1. Using data-placeholder attribute:
<option value="" data-placeholder="Choose an option...">Choose an option...</option>
  1. Using JavaScript:
<option value="">Select something...</option>
  1. Using configuration:
new YoSelect(element, {
placeholder: 'Please select...'
});

Custom Styling

Add custom classes to tags in multiple selection mode:

new YoSelect(element, {
classTag: 'custom-tag-class'
});

Event Listener

Add an event listener to the select element:

const select = new YoSelect(element);
select.element.addEventListener('change', (event) => {
console.log('Selection changed:', event.target.value);
});

Browser Support

YoSelect is compatible with all modern browsers including:

  • Chrome
  • Firefox
  • Safari
  • Edge

Examples

Basic Single Select with Search

<select class="yoSelect" data-yo-search="true">
<option value="">Select a country</option>
<option value="us" data-yo-img="flag-us.png">United States</option>
<option value="uk" data-yo-img="flag-uk.png">United Kingdom</option>
</select>

Multiple Select with Create Option

<select class="yoSelect" multiple data-yo-search="true" data-yo-creatable="true">
<option value="js">JavaScript</option>
<option value="py">Python</option>
</select>

Searchable Tags with Custom Styling

<select class="yoSelect" multiple data-yo-search="true">
<option value="tag1">Tag 1</option>
<option value="tag2">Tag 2</option>
</select>
<script>
new YoSelect(element, {
classTag: 'custom-tag',
searchPlaceholder: 'Search tags...'
});
</script>

License

MIT License