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-range-slider

v0.76.5

Published

Dual-handle range slider mapping a min–max domain to thumb positions, with optional value bubbles and a third handle for a single marker position; emits changeRangeValues with real and percentage values on change.

Downloads

3,275

Readme

hb-range-slider (range-slider)

Category: inputs
Tags: inputs, slider
Package: @htmlbricks/hb-range-slider

Overview

hb-range-slider is a shadow-DOM web component that renders a dual-handle range slider. Two thumbs select a sub-range on a linear domain defined by min and max; the selected interval is mapped to real values and percentages on the track. An optional third handle acts as a single position marker along the same domain; its value appears in the emitted payload as positionValReal and positionPercent.

Optional value bubbles (withbubbles) show rounded min/max values above the outer thumbs. The component uses native <input type="range"> controls (visually hidden) for pointer and keyboard interaction; the visible track, thumbs, and bubbles are styled with Bulma-driven CSS variables.

When the user commits a change (native change on the range inputs), the component dispatches changeRangeValues with the current min, max, and marker positions in both domain units and 0–100 track percent.

Custom element

<hb-range-slider …></hb-range-slider>

Attributes (host)

Web component attributes use snake_case. Values from HTML are strings. Use numeric strings for numbers (for example "0", "42.5"). For booleans where noted, use yes or no (project convention for host markup).

| Attribute | Required | Description | |-----------|----------|-------------| | min | No | Lower bound of the value domain. Default 0 (internal default when missing or invalid). Coerced with Number(). | | max | No | Upper bound of the value domain. Default 100. Must span a range with min for meaningful mapping. Coerced with Number(). | | minval | No | Initial left thumb value in domain units. Clamped to min..max, then converted to an internal left percentage. Consumed once when applied (not kept as a live two-way binding from attributes alone). | | maxval | No | Initial right thumb value in domain units. Clamped to min..max, then converted to an internal right percentage. Consumed once when applied. | | position_value | No | Initial marker thumb value in domain units. Clamped to min..max, then converted to internal marker percentage. Consumed once when applied. 0 is a valid value. | | withbubbles | No | Set to yes to show value bubbles on the min and max thumbs. Omit the attribute for the default (bubbles off). Prefer yes / no for boolean host strings in line with other hb-* inputs. | | id | No | Optional host element id. | | style | No | Optional inline styles on the host element. |

Domain mapping: Internal thumbs move on an abstract 0–100 track. A thumb at percent p maps to real value min + ((max - min) / 100) * p. The marker thumb is kept between the left and right thumbs when percentages are adjusted.

Events

changeRangeValues

Fired on change (after the user finishes adjusting a handle), not on every intermediate input tick.

event.detail (all numbers):

| Property | Description | |----------|-------------| | minValue | Left thumb value in domain units (derived from min, max, and left percent). | | maxValue | Right thumb value in domain units. | | minPercent | Left thumb position on the 0–100 internal track. | | maxPercent | Right thumb position on the 0–100 internal track. | | positionPercent | Marker thumb position on the 0–100 internal track. | | positionValReal | Marker value in domain units. |

TypeScript shapes for Component and Events live in types/webcomponent.type.d.ts.

Example listener:

<hb-range-slider id="range" min="10" max="25" minval="13" maxval="20" withbubbles="yes"></hb-range-slider>
<script>
  document.getElementById("range").addEventListener("changeRangeValues", (e) => {
    console.log(e.detail.minValue, e.detail.maxValue, e.detail.positionValReal);
  });
</script>

Styling

The host forwards Bulma 1.x CSS variables into internal tokens used by the track, thumbs, and bubbles. Prefer --bulma-* on :host or ancestors; see Bulma CSS variables.

| Variable | Role | |----------|------| | --bulma-primary | Selected range fill and bubble background (via --hb-slider-fill / --hb-slider-bubble). | | --bulma-primary-invert | Bubble label text color. | | --bulma-border | Unselected track segments (--hb-slider-track). | | --bulma-scheme-main | Outer thumb face (--hb-slider-thumb-bg). | | --bulma-text | Inner thumb contrast / marker thumb tone (--hb-slider-thumb-inner). | | --hb-slider-background-color | Optional override for fill and bubble tint (defaults through --bulma-primary). |

Internal wiring (from styles/webcomponent.scss): --hb-slider-fill, --hb-slider-track, --hb-slider-thumb-bg, --hb-slider-thumb-inner, --hb-slider-bubble, --hb-slider-bubble-text.

::part names (from extra/docs.ts / styleSetup):

| Part | Description | |------|-------------| | inverse | Host-side wrappers that paint the unfilled track beside the selected range. | | the-range | Filled segment between the two outer thumbs. | | the-thumb | Draggable handles for the range endpoints (and the marker’s outer thumb styling). | | the-thumb-internal | Smaller center handle for the optional marker thumb between the endpoints. | | sign | Value bubble / label attached to a thumb when withbubbles is enabled. |

When bubbles are enabled, the host adds the class hb-range-slider--bubbles on the root container for extra vertical spacing.

Slots

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

Examples

Basic range with bubbles:

<hb-range-slider min="0" max="100" minval="20" maxval="80" withbubbles="yes"></hb-range-slider>

Narrow domain with initial marker (matches the withPositionValue example in extra/docs.ts):

<hb-range-slider
  min="10"
  max="25"
  minval="13"
  maxval="20"
  position_value="17"
  withbubbles="yes"
></hb-range-slider>

License

Component metadata in extra/docs.ts lists Apache-2.0 for package licensing information; see the referenced LICENSE.md in that context when distributing the package.