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

v0.76.5

Published

Range slider (`type="range"`). Optional `params` as `InputRangeParams`: `min` / `max` may be numbers or numeric strings; each key is applied only if present on `params` (same `hasOwnProperty` pattern as number input). Coerces values for validation and nat

Readme

hb-input-range

Category: inputs · Tags: inputs

Overview

hb-input-range is a Bulma-styled web component that wraps a native HTML range control (type="range"). You drive it with a single JSON schemaentry attribute: bounds come from optional params.min / params.max, and the component validates against those bounds when the field is required. It emits a setVal custom event whenever the effective value or validity changes (after deduplication).

Use it when you need a string-attribute-friendly range slider that matches the same schemaentry pattern as other hb-input-* fields in forms.

Custom element

| Name | Tag | | --- | --- | | hb-input-range | <hb-input-range …></hb-input-range> |

Host attributes (HTML)

Web component attributes are strings. Pass booleans as yes / no, numbers inside JSON as JSON numbers, and structured data as a JSON string on schemaentry.

| Attribute | Required | Description | |-----------|----------|-------------| | schemaentry | Yes | JSON describing the field (see below). If the attribute is missing, JSON parsing fails, or the value is null, nothing is rendered. A parsed object without id still shows the range, but setVal is not emitted. | | show_validation | No | yes or no (default in code: no). When yes, and schemaentry.validationTip is set, an invalid value shows Bulma help is-danger with that tip. | | id | No | Optional id on the host element (component typings). | | style | No | Optional inline styles on the host. |

schemaentry JSON

The attribute value is a serialized object aligned with FormSchemaEntry in types/webcomponent.type.d.ts (shared keys come from ../../form/types/webcomponent.type).

| Property | Description | |----------|-------------| | id | Required for setVal dispatches (the effect bails out without it). Also sets the native input id. | | value | Optional initial numeric value. Non-numeric or missing values become undefined internally. | | required | When true, the value must be set and satisfy any declared min / max (see validation). | | disabled | When true, the slider is non-interactive. | | readonly | Passed through to the native readonly attribute. | | placeholder | Passed through to the native placeholder attribute. | | validationTip | Message shown when show_validation is yes and the field is invalid. | | params | Optional InputRangeParams: slider bounds and validation limits. |

Bounds (params) — type InputRangeParams: optional min and/or max, each a number or numeric string. The implementation uses Object.prototype.hasOwnProperty.call(params, "min") (and similarly for "max"): a key must exist on params for the native min / max attributes and validation to use it. If a key is missing, that side is unconstrained.

The shared schema also allows other keys (for example label); this component does not render a label in its template—it renders the range input and optional invalid feedback only.

Validation

  • required is false or omitted: the component treats the field as valid (valid: true in setVal).
  • required is true: the value must be a defined number, and:
    • if params has a min key, value >= min (after coercion to number);
    • if params has a max key, value <= max.

Invalid state uses --bulma-danger for the danger help text. The native control’s accent-color follows Bulma tokens (see Styling).

Events

| Event | detail | |-------|----------| | setVal | { value: number \| undefined; valid: boolean; id: string } |

setVal is dispatched when id is present and the payload changes (value, validity, or id). Listen with addEventListener("setVal", …) in the host page or framework.

Styling

Bulma CSS variables (:host)

Documented in extra/docs.ts (styleSetup.vars):

| Variable | Role | |----------|------| | --bulma-text | Label and current value readout color. | | --bulma-border | Track baseline color where Bulma maps borders to the range. | | --bulma-link | Native range accent-color (thumb / filled portion). In styles/webcomponent.scss, accent-color is set to var(--bulma-link, …). | | --bulma-danger | Invalid state and help is-danger when out of min / max or empty. | | --bulma-success | Valid thumb accent when show_validation marks the field as valid. |

Sass entry: styles/bulma.scss forwards Bulma form/shared, form/input-textarea, and form/tools, then applies the light theme on :host.

See Bulma CSS variables for how to set them on the host or ancestor.

CSS parts

| Part | Description | |------|-------------| | input | The native type="range" element (class hb-input-range-native). | | invalid-feedback | The p.help.is-danger node when validation feedback is shown. |

The control is display: inline-block on :host, full width inside the host, with fixed height for the native range (styles/webcomponent.scss).

TypeScript

Authoring types: types/webcomponent.type.d.tsInputRangeParams, FormSchemaEntry, Component, Events.

After npm run build:wc, generated DOM typings include hb-input-range in types/html-elements.d.ts and Svelte element typings in types/svelte-elements.d.ts.

Examples

Minimal range (0–100)

<hb-input-range
  schemaentry='{"id":"volume","required":true,"params":{"min":0,"max":100},"value":50}'
  show_validation="no"
></hb-input-range>

Required with validation message

<hb-input-range
  schemaentry='{"id":"level","required":true,"params":{"min":1,"max":10},"value":1,"validationTip":"Pick a level between 1 and 10."}'
  show_validation="yes"
></hb-input-range>

Listen for changes (vanilla JS)

const el = document.querySelector("hb-input-range");
el.addEventListener("setVal", (e) => {
  const { value, valid, id } = e.detail;
  console.log(id, value, valid);
});

Disabled slider

<hb-input-range
  schemaentry='{"id":"volume_locked","label":"Volume","params":{"min":0,"max":100},"value":65,"disabled":true}'
></hb-input-range>

Package metadata

Component name in catalog setup: hb-input-range (extra/docs.tscomponentSetup). Description and Storybook-oriented examples also live in extra/docs.ts.