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 🙏

© 2024 – Pkg Stats / Ryan Hefner

tjb-menu

v0.0.2

Published

awesome menu webcomponent

Downloads

2

Readme

tjb-menu

Webcomponents Main Menu.
Creating accessible and feature rich menus is a tedious task. So here is a re-useable webcomponent menu to make your development fun again.
It is accessible and mobile friendly by default and features sub-menus.

Example

https://tjb-webcomponents.github.io/tjb-menu/

Add to project

You might want to use a Polyfill for WebComponent:

<script src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/1.2.0/webcomponents-lite.js"></script>

Include via HTML

Include it:

<script
  src="https://tjb-webcomponents.github.io/tjb-menu/tjb-menu.min.js"
  type="module"
></script>

Include via JavaScript

import 'https://tjb-webcomponents.github.io/tjb-menu/tjb-menu.min.js'

Include via NPM

Console:

npm i -S tjb-menu

Then in your code:

import 'tjb-menu';

Useage

Simplified:

<tjb-menu data-title="Main Menu">
  <span slot="logo">[YOUR LOGO]</span>

  <tjb-menu-item slot="menu-item">
    <a slot="menu-item-link">[YOUR LINK]</a>
  </tjb-menu-item>

  <tjb-menu-item-sub slot="menu-item">
    <div slot="menu-item-sub-toggle">[YOUR SUB-MENU TRIGGER]</div>

    <tjb-menu-item slot="menu-item">
      <a slot="menu-item-link">[YOUR SUB-MENU LINK]</a>
    </tjb-menu-item>
  </tjb-menu-item-sub>
</tjb-menu>
  • tjb-menu the parent
  • tjb-menu-item-sub a submenu
  • tjb-menu-item an item in the menu

Full example:

<tjb-menu data-title="Main Menu" class="tjb-menu">
  <span slot="logo"> My Company </span>

  <tjb-menu-item slot="menu-item">
    <a href="#/shop" class="tjb-menu-link" slot="menu-item-link"> shop </a>
  </tjb-menu-item>

  <tjb-menu-item slot="menu-item">
    <a href="#/contact" class="tjb-menu-link" slot="menu-item-link">
      contact
    </a>
  </tjb-menu-item>

  <tjb-menu-item-sub slot="menu-item">
    <svg role="img" aria-labelledby="title" slot="menu-item-sub-toggle">
      <title>select language</title>
      <use role="presentation" xlink:href="#icon-world" />
    </svg>

    <tjb-menu-item slot="menu-item">
      <a href="#/english" class="tjb-menu-link" slot="menu-item-link">
        English
      </a>
    </tjb-menu-item>

    <tjb-menu-item slot="menu-item">
      <a href="#/german" class="tjb-menu-link" slot="menu-item-link">
        German (Deutsch)
      </a>
    </tjb-menu-item>
  </tjb-menu-item-sub>

  <tjb-menu-item slot="menu-item">
    <a href="#/auth" class="tjb-menu-link" slot="menu-item-link"> login </a>
  </tjb-menu-item>

  <tjb-menu-item slot="menu-item">
    <a href="#/buy" class="tjb-menu-link" slot="menu-item-link"> buy now </a>
  </tjb-menu-item>
</tjb-menu>

Suggested global styling

:root {
  --c-primary: #3555f5;
}

.tjb-menu {
  --tjb-menu-sub-bg: white;
  --tjb-menu-sub-b: 1px solid rgba(100, 100, 100, 0.1);
  --tjb-menu-sub-c: black;
  --tjb-menu-toggler-color: black;
  --tjb-menu-toggler-hover: var(--c-primary);
  --tjb-menu-mobile-bg: white;
  --tjb-menu-mobile-c: black;
  background: white;
  color: black;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.05);
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 1000;
  padding: 20px;
  box-sizing: border-box;
  white-space: nowrap;
}

.tjb-menu-link {
  cursor: pointer;
  color: inherit;
  text-decoration: none;
  text-transform: uppercase;
  padding: 15px;
  display: inline-block;
}

.tjb-menu-link:focus,
.tjb-menu-link:hover,
.tjb-menu-link:active {
  fill: var(--primary);
  color: var(--primary);
}

Enjoy

Typewriter Gif