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

@htmlbricks/hb-sidenav-button

v0.76.5

Published

Compact sidebar row as a nav button: optional Bootstrap Icons (bi-*) icon, Bulma tag badge, or visual types (switch, checkbox, radio) from navlink JSON; dispatches pageChange with the row key on click. Used by sidebar-cards-navigator and similar stacked m

Readme

hb-sidenav-button (sidenav-button)

Category: layout
Tags: layout, navigation
Package: @htmlbricks/hb-sidenav-button

Overview

hb-sidenav-button is a single sidebar navigation row: a full-width ghost Bulma button inside a list item (<li>). It is meant to be used in stacked menus (for example together with hb-sidebar-cards-navigator). Clicking the row dispatches a pageChange custom event whose detail is the link’s key, so the host can switch views or routes.

The row can show:

  • a Bootstrap Icons glyph (when bootstrapIcon is set),
  • a Bulma tag badge (when badge is set),
  • or control-style visuals for type checkbox, radio, or switch (when there is no badge, using icon state from value).

Optional selected sets aria-current="page" and Bulma “selected” styling for the active row.

Custom element

<hb-sidenav-button …></hb-sidenav-button>

Attributes

Web component attributes are strings. Pass complex data as a JSON string on navlink.

| Attribute | Required | Description | |-----------|----------|-------------| | navlink | yes | JSON string describing one navigation item (see Navlink object below). If the runtime binding delivers a string, the component attempts JSON.parse on it. |

The TypeScript Component type in types/webcomponent.type.d.ts also lists optional id and style. Rendering is driven by navlink; you can still set a normal HTML id on <hb-sidenav-button> in the document when useful.

Navlink object (INavLink)

All consumer-facing keys use the shape below (logical names; in JSON use these exact property names).

| Property | Type | Description | |----------|------|-------------| | key | string | Identifier for this row; sent as pageChange detail page. | | text | string | Primary label (main text in the row). | | bootstrapIcon | string (optional) | Bootstrap Icons name without the bi- prefix (for example "house-door"bi-house-door). Shown when the row is not using the checkbox/radio-only layout, or as the leading icon for a generic row. | | subtext | string (optional) | Present in typings for shared nav models; this component does not render subtext. | | badge | object (optional) | { "text": string, "class"?: string, "classcolor"?: string }. Renders a Bulma tag on the right. Bulma modifier classes can be passed via class (default-like behavior in markup uses is-rounded) and classcolor (defaults toward is-light). When badge is set, type-based switch UI is not shown (badge takes precedence for the trailing area). | | value | string, number, or boolean (optional) | Drives checkbox / radio / switch visuals (true / filled vs off). | | selected | boolean (optional) | When true, the row is styled as current and exposes aria-current="page". | | type | string (optional) | One of "switch", "range", "radio", "checkbox", "button". Rendered behavior: checkbox and radio show check/circle icons when there is no badge; switch shows a toggle icon when there is no badge; "button" and "range" do not add extra control icons beyond bootstrapIcon / text. |

Events

| Event | Detail | When | |-------|--------|------| | pageChange | { page: string } | Every click on the row button. page is the navlink key. |

Listen in the DOM:

el.addEventListener("pageChange", (e) => {
  console.log(e.detail.page);
});

Styling

Styles use Bulma inside the shadow root. Theme the host page with public --bulma-* variables (see Bulma CSS variables). Variables referenced by this component are documented in extra/docs.ts; the main ones are:

| Variable | Role | |----------|------| | --bulma-link | Left accent stripe and mixes for the selected (aria-current) row. | | --bulma-link-text | Text color on the selected row background mix. | | --bulma-scheme-main-bis | Hover wash for rows. | | --bulma-radius | Corner rounding for each row. | | --bulma-text-weak | Muted tone where weak contrast is used (for example badge-related styling). |

CSS part: li — the outer list item wrapper (::part(li) from the light DOM).

Icons: rows use Bootstrap Icons (bi-*). The component loads the icon font (see component.wc.svelte / styles). For predictable versions in production pages, prefer pinning a known Bootstrap Icons URL instead of relying only on @latest where you control the document.

Slots

None (htmlSlots is empty in extra/docs.ts).

Integration notes

  • In Storybook, nav_type is a control helper for picking a type value; at runtime the field lives on navlink.type inside the JSON navlink string.
  • Wrap multiple hb-sidenav-button elements in a <ul class="..."> in the light DOM if you need a semantic list; each instance renders one <li part="li">.

HTML examples

Plain icon + label

<hb-sidenav-button
  navlink='{"text":"Home","key":"home","bootstrapIcon":"house-door"}'
></hb-sidenav-button>

Selected row

<hb-sidenav-button
  navlink='{"text":"Home","key":"home","bootstrapIcon":"house-door","selected":true}'
></hb-sidenav-button>

Badge

<hb-sidenav-button
  navlink='{"text":"Messages","key":"messages","bootstrapIcon":"envelope","badge":{"text":"3","classcolor":"is-danger"}}'
></hb-sidenav-button>

Switch (no badge)

<hb-sidenav-button
  navlink='{"text":"Notifications","key":"notifications","bootstrapIcon":"bell","type":"switch","value":true}'
></hb-sidenav-button>

Checkbox / radio (no badge)

<hb-sidenav-button
  navlink='{"text":"Option A","key":"a","type":"checkbox","value":true}'
></hb-sidenav-button>

License

Package metadata references Apache-2.0 (see LICENSE.md in the published package when consuming from npm).