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

@nekodev/modernselect

v1.0.5

Published

Example : modern-select/demo/index.html

Readme

Modern Select

Example : modern-select/demo/index.html

alt preview

installation

Download the zip and include build files inside your html file

<link rel="stylesheet" href="path/to/modernselect.css">
<script src="path/to/modernselect.js"></script>

or install with npm

npm install @nekodev/modernselect --save

Include the files :

From your javascript

import ModernSelect from '@nekodev/modernselect'

From your scss

@import '~@nekodev/modernselect/src/scss/modernselect.scss'

If using SCSS, you can customize some varaible :

$option-background: #FFFFFF !default;
$option-background-hover: lightgrey !default;
$output-radius: .2em !default;
$output-icon-size: 30px !default;
$dropdown-animation-duration: .3s !default;
$border: solid 1px rgba(0, 0, 0, .2) !default;

Initialisation

<div class="modern-select" id="modern-select">
    <div data-value="" data-placeholder>Select value</div>
    <div data-value="1">
        <div class="select-content">
            <img src="https://picsum.photos/id/0/200">
            <span>Computer</span>
        </div>
    </div>
    <div data-value="2">
        <div class="select-content">
            <img src="https://picsum.photos/id/10/200">
            <span>Forest</span>
        </div>
    </div>
    <div data-value="3">
        <div class="select-content">
            <img src="https://picsum.photos/id/237/200">
            <span>Dog</span>
        </div>
    </div>
    <div data-value="4">
        <div class="select-content">
            <img src="https://picsum.photos/id/1001/200">
            <span>Sea</span>
        </div>
    </div>
</div>
let modernSelect = new ModernSelect("#modern-select", {
                        formName: "choice",
                        animation: "fade-in",
                        icon: `<i class="fas fa-arrow-down"></i>`,
                        customClass: "my-custom-class"
                    })

All element with data-value propertie have same role than <option value="someValue"></option>. So all data-value elements are considère has option. You can also customise the option has you need.

Options

| Option | Value type | Description | |-------------|------------|-----------------------------------------------------------------------------------------------------------------------------------| | formName | String | The name of the select input. You can access to form request name with this property | | animation | String | The animation class that you want to apply when the dropdown is opened. You can create your once or use library like animate.css. | | icon | String | You can add some image or fontawesome element for example. ex. : icon: <i class="fas fa-arrow-down"></i> | | customClass | String | The custom class you want to add to the output element. With this class, you can change the design of this element. |

Methods

| Method | return | Description | |--------|--------|-----------------------------------------------| | value | void | Set a new value to the custom-select element. | | close | void | Close the dropdown. | | on | void | Event listener for triggered event. |

Events

Your element send three events : change, open, close You can listen event with :

modernSelect.on('change', function() {
    doSometing()
})

The change event is trigger only if the value of the element is changing.
Warning : If you change the value with the value() method and if the value is not defined in any data-value element, you can get a warrning in the console. No effect on your script, no crash. For turn off this feature set debug to false like this :

modernSelect.debug = false