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

@hapticjs/web-components

v0.1.0

Published

Framework-agnostic custom elements for Haptic.js haptic engine

Readme

@hapticjs/web-components

Framework-agnostic custom elements for Haptic.js -- the universal haptic feedback engine. Works with plain HTML, or any framework.

Installation

npm install @hapticjs/web-components

Note: @hapticjs/core is bundled in, so you do not need to install it separately.

Usage

Import once to register all custom elements:

<script type="module">
  import '@hapticjs/web-components';
</script>

<haptic-button>

A button that triggers haptic feedback on click.

<!-- Semantic effects -->
<haptic-button effect="tap">Tap me</haptic-button>
<haptic-button effect="success">Submit</haptic-button>
<haptic-button effect="error">Delete</haptic-button>
<haptic-button effect="warning">Careful</haptic-button>

<!-- Custom HPL pattern -->
<haptic-button pattern="~~..##..@@">Custom pattern</haptic-button>

<!-- With intensity -->
<haptic-button effect="tap" intensity="0.3">Soft tap</haptic-button>

<!-- Disabled -->
<haptic-button effect="tap" disabled>Disabled</haptic-button>

Attributes:

| Attribute | Description | |-----------|-------------| | effect | Semantic effect name: tap, doubleTap, success, warning, error, selection, impact | | pattern | HPL pattern string (takes precedence over effect) | | intensity | Intensity value (0-1) for effects that support it | | disabled | Disables the button and haptic feedback |

<haptic-surface>

Wraps any content and adds haptic feedback on pointer interactions.

<haptic-surface on-tap="tap" on-press="success" on-hover="selection">
  <div class="card">
    <h2>Interactive card</h2>
    <p>Tap, press, or hover for feedback</p>
  </div>
</haptic-surface>

<!-- With HPL pattern -->
<haptic-surface on-tap="~~..##">
  <img src="photo.jpg" alt="Photo" />
</haptic-surface>

Attributes:

| Attribute | Description | |-----------|-------------| | on-tap | Effect or HPL pattern on pointerdown | | on-press | Effect or HPL pattern on pointerup | | on-hover | Effect or HPL pattern on pointerenter |

<haptic-toggle>

A toggle switch with built-in haptic feedback.

<!-- Basic toggle -->
<haptic-toggle></haptic-toggle>

<!-- Pre-checked -->
<haptic-toggle checked></haptic-toggle>

<!-- Custom effects for on/off states -->
<haptic-toggle on-effect="success" off-effect="tap"></haptic-toggle>

Listen for changes:

document.querySelector('haptic-toggle').addEventListener('change', (e) => {
  console.log('Toggled:', e.detail.checked);
});

Attributes:

| Attribute | Description | |-----------|-------------| | checked | Whether the toggle is on | | on-effect | Effect or HPL pattern when toggled on | | off-effect | Effect or HPL pattern when toggled off | | disabled | Disables the toggle |

CSS Parts:

| Part | Description | |------|-------------| | track | The toggle track | | thumb | The toggle thumb/knob |

Styling

All elements use Shadow DOM. You can style them with CSS custom properties or ::part():

haptic-button::part(button) {
  background: #4caf50;
  color: white;
  padding: 8px 16px;
  border-radius: 4px;
}

haptic-toggle::part(track) {
  background: #ddd;
}

Programmatic Use

You can also import the element classes directly:

import { HapticButtonElement, HapticSurfaceElement, HapticToggleElement } from '@hapticjs/web-components';