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

@jesperkov/create-dropdown

v2.0.1

Published

Add dropdown functionality to your webpage

Readme

create-dropdown

create-dropdown, brought to you by jesperkov.

This is a JS module that allows you to easily create styled dropdown menus.

Demo

Demo

Prerequisites

  • A module bundler (i.e. Webpack, Browserify, etc.)

Installation

npm i @jesperkov/create-dropdown

Usage

To avoid unwanted errors, copy and paste the code below and modify it to fit your application.

HTML

Format your dropdown like so:

<div class = "dropdown-menu">
    <div class = "expand-button">
        <span> Expand Me <span>
    </div>
    <div class = "options">
        <div class = "option">
            <span>Option 1</span>
        </div>
        <div class = "option">
            <span>Option 2</span>
        </div>
        <div class = "option">
            <span>Option 3</span>
        </div>
    </div>
</div>

WARNING: DO NOT FORGET TO INCLUDE THE SPANS

Javascript

Your Javascript will simply need to look like this:

import createDropdown from "@jesperkov/create-dropdown";

const dropdownMenu = document.querySelector('.dropdown-menu');
const expandButton = document.querySelector('.expand-button');
const options = document.querySelector('.options');

createDropdown(dropdownMenu, expandButton, options);

And thats it! No CSS is required, as the styling will be taken care of by the createDropdown function. However, if you want to modify the style or create your own, this is entirely possible by simply selected the elements from your own CSS stylesheet.

Optional

We advise you to set the opacity of the options div to 0 on your own CSS stylesheet. Since the styling is done by Javascript, there is a possibility that you may get an unwanted flash of the options div before the script loads and hides it. By setting the opacity to 0 on your own stylesheet, you can avoid this potential problem entirely.