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-dropdown-simple

v0.76.5

Published

Bootstrap dropdown menu: `list` is a JSON array of items with `key` (and labels as defined in your schema). Toggle open state with the trigger; choosing an item emits `dropDownClick` with the item `key` and closes the menu. `open` accepts boolean or strin

Downloads

4,118

Readme

hb-dropdown-simple (dropdown-simple)

Category: overlays
Tags: overlays, menu

Overview

hb-dropdown-simple is a Bulma-styled dropdown: a clickable trigger opens a floating menu built from a declarative list. Plain rows dispatch a selection event with the item key and close the menu; rows with linkHref render as normal links instead. The component also reports open/close toggles so you can sync state with the host page.

Custom element

<hb-dropdown-simple></hb-dropdown-simple>

Tag name: hb-dropdown-simple (see component.wc.svelte).

Public API (props / attributes)

Web component attributes are strings in HTML. Use snake_case names where your tooling maps props to attributes (same logical names as the TypeScript Component type).

| Prop | Type (authoring) | HTML / notes | | --- | --- | --- | | id | string (optional) | Passed through on dropdownSwitch so multiple instances can be distinguished. | | style | string (optional) | Standard host styling; the implementation also reads float on the host to choose a default position when position is omitted. | | position | "left" | "right" (optional) | Aligns the menu (is-right when "right"). If unset, position defaults to "right" when the host element’s inline style.float is "right", otherwise "left". | | list | IDropDownMenuListItem[] | JSON string in HTML. Each item should include at least key and label. Optional: badge, group, linkHref. The component parses JSON when the runtime value is not already a usable array shape. | | open | boolean or "yes" | "no" | Controls the open state (is-active). String "yes" and boolean true open; "no" and false close. Note: an empty string for open is treated like open (true) in the current implementation. |

List item shape (IDropDownMenuListItem)

  • key (string) — Identifier emitted with dropDownClick for non-link rows.
  • label (string) — Visible text for the row.
  • badge (number, optional) — Present in the public type for richer menus; the default markup does not render it.
  • group (string, optional) — Same as badge: typed for integrations; not rendered by the default template.
  • linkHref (string, optional) — If set, the row is an <a class="dropdown-item"> to that URL instead of a clickable div that emits dropDownClick.

Slots

| Slot | Purpose | | --- | --- | | dropdownbutton | Content of the trigger. Default fallback text is btn. The host wraps this slot in a clickable region that toggles the menu. |

Events

Listen with addEventListener using the exact event names below (they are case-sensitive).

| Event | detail | When | | --- | --- | --- | | dropdownSwitch | { open: boolean; id: string } | Whenever the user toggles the menu via the trigger (open becomes the new state). | | dropDownClick | { key: string } | When the user activates a non-link menu row (linkHref not set). The implementation then toggles the menu closed. |

Rows with linkHref are rendered as links only; they do not dispatch dropDownClick from this component.

Styling

Theming uses Bulma CSS variables on :host. Common tokens referenced for this component:

| Variable | Role | | --- | --- | | --bulma-scheme-main | Background of the floating menu panel (dropdown-content). | | --bulma-border | Border color for the menu and separators between items. | | --bulma-text | Default text color for menu rows and the trigger area. | | --bulma-link | Accent for link rows (linkHref) and interactive hover states. |

See the Bulma CSS variables documentation for the full variable set.

CSS ::part names

| Part | Targets | Typical overrides | | --- | --- | --- | | dropdown | Bulma dropdown root (active/right modifiers) | Layout, margins, z-index for stacking. | | dropdownbutton | Wrapper around the dropdownbutton slot | Padding, min-width, typography on the control. | | dropdowncontent | Floating dropdown-menu panel | Width, max-height, shadow for the opened list. |

Behavior summary

  1. Clicking the trigger toggles open/closed and emits dropdownSwitch.
  2. Clicking a row without linkHref runs dropDownClick with that row’s key, then closes the menu.
  3. Rows with linkHref behave like normal links; closing the menu is left to navigation or host logic.

Minimal HTML example

<hb-dropdown-simple
  list='[{"key":"a","label":"Option A"},{"key":"b","label":"Option B"}]'
  position="left"
></hb-dropdown-simple>

Example with a link row and controlled openness (strings yes / no):

<hb-dropdown-simple
  id="actions-1"
  open="yes"
  list='[{"key":"edit","label":"Edit"},{"key":"docs","label":"Docs","linkHref":"https://example.com/docs"}]'
></hb-dropdown-simple>

Package metadata (from docs)

  • npm: @htmlbricks/hb-dropdown-simple
  • IIFE bundle: main.iife.js (see your build / CDN layout for this package).