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

@esavoretti/flexmenu

v1.1.2

Published

Menu web component with built-in flexibility to accommodate itself to mobile screens

Readme

flexmenu

Menu web component with built-in flexibility to accommodate itself to mobile screens

Getting Started

Let's begin with a classic example of the flexible menu, to demonstrate its capabilities by outlining the navigation structure of the documentation for the flexible menu itself. The documentation is organized into several sections, each dedicated to a specific component of the flexible menu. You can navigate through these sections using the menu items below.

I. Installation

The fastest way to get started with the flexible menu is to include the flexmenu.js script in your HTML file, like so:

<script src="https://unpkg.com/@esavoretti/flexmenu" type="module"></script>

or

<script type="module" src="https://cdn.jsdelivr.net/gh/sandy98/flexmenu/flexmenu.js"></script>

Of course, you can also download the flexmenu.js file and include it locally in your project. This includes intalling it via

 npm install @esavoretti/flexmenu 

and then copying it to your project folder and including it with a relative path, like so:

<script src="path/to/flexmenu.js" type="module"></script>

In any case, always keep in mind that the flexmenu.js script must be included with the type="module" attribute, as it uses ES6 module syntax.

II. Usage

Here's a typical structure showing flex-menu as the main component, with color-label, menu-item, menu-list, main-menu, and hamburger-button as its subcomponents. Each of these components has its own documentation section that you can access through the menu.

                <flex-menu>
                    <menu-item>
                        Home
                    </menu-item>
                    <menu-list menu-title="Documentation">
                        <menu-item href="#getting-started">Getting Started</menu-item>
                        <menu-separator></menu-separator>
                        <menu-item href="#color-label">Color Label</menu-item>
                        <menu-item href="#menu-item">Menu Item</menu-item>
                        <menu-item href="#menu-list">Menu List</menu-item>
                        <menu-item href="#main-menu">Main Menu</menu-item>
                        <menu-item href="#hamburger-button">Hamburger Button</menu-item>
                    </menu-list>
                    <menu-item href="#configuration">Configuration</menu-item>
                    <menu-item href="#about">About</menu-item>
                </flex-menu>
            

The previous html code snippet illustrates how to structure the flexible menu with its various components. Each menu item corresponds to a section in the documentation, allowing you to easily navigate and learn

Provided Components

  • <color-label>: Base presentation element utilizing the styling mixin pipeline.
  • <menu-item>: Clickable, navigation-ready component designed to live inside menus.
  • <menu-list>: Container element. Accepts <menu-item>, <menu-list> and <menu-separator> elements.
  • <hamburger-button>: Responsive trigger element.
  • <flex-menu>: The top-level responsive layout framework. : Base presentation element utilizing the styling mixin pipeline.

Global Styling System

All elements derived from the internal ColorMixin pipeline feature fully synchronized CSS custom properties, HTML attributes, and JavaScript DOM object properties.

Custom Styling Attributes / CSS Variables

Pass these as HTML attributes or set them in JS. The component dynamically translates them into matching CSS variables behind a Shadow DOM boundary.

| HTML Attribute | DOM Property | Default Value | Description | | -------------- | ------------ | ---------------------- | ------------------------------- | | fg-color | fgColor | aliceblue | Text/Foreground color | | bg-color | bgColor | steelblue | Default state background color | | sel-color | selColor | rgb(190, 252, 190) | Selected state background color |


Component Reference

  1. <color-label>

A basic structural container that exposes the fundamental color theme mapping.

html

<color-label fg-color="white" bg-color="#333" sel-color="coral">
  Label Content
</color-label>

Properties & Methods

  • selected (Boolean) : Gets or sets the visual active selection state.
  • select() : Explicitly forces the component into the selected state.
  • unselect() : Explicitly removes the selected state.
  • toggleSelected() : Reverses the current selection state.

  1. <menu-item>

Extends <color-label> to provide navigation handling, interaction patterns, and parent-sibling awareness.

html

<menu-item href="#gallery" use-default-handler fg-color="yellow">
  Gallery
</menu-item>

Unique Attributes & Properties

  • href / href (String, default: '#') : Destination anchor link URL target.
  • use-default-handler / useDefaultHandler (Boolean, default: false) : When active, automatically transitions active sibling states and routes the page location automatically upon user click.

Methods

  • defaultHandler(force = false) **: Processes mutual exclusivity logic. Clears target states from matching sibling **<menu-item> elements, selects itself, and pushes changes to window location tracking.
  • unselectSiblings() **: Manually queries parent nodes to strip **.selected classes from competing menu items.

Custom Events Emitted

  • menu-item-click : Fires on selection interaction. Bubbles outside the shadow root safely.

  • event.detail structure : javascript

    { target: HTMLElement, // The specific menu-item instance type: 'click', srcEvent: MouseEvent // Native mouse click details }

Demo

Demo Site