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

web-haptics-toast

v1.0.1

Published

Standalone React toasts with built-in haptics and a Sonner-compatible API. Single dependency—no separate haptics package.

Readme

web-haptics-toast

Standalone React toasts with haptics built in: one npm install, and you get the UI, styles, and vibration/audio engine together—no extra packages for haptics.

The toast() and <Toaster /> API is compatible with Sonner, so you can migrate or adopt without new mental models (including an optional npm alias so imports can stay from 'sonner').

By DesignByte · GitHub


Already using Sonner? (zero code change)

Replace your package and keep all existing imports. Your app keeps import { Toaster, toast } from 'sonner':

# npm
npm uninstall sonner && npm install sonner@npm:web-haptics-toast

# pnpm
pnpm remove sonner && pnpm add sonner@npm:web-haptics-toast

# yarn
yarn remove sonner && yarn add sonner@npm:web-haptics-toast

# bun
bun remove sonner && bun add sonner@npm:web-haptics-toast

No import changes needed. Haptics are on by default; disable with <Toaster haptics={false} />.

On the docs site in this repo, see Migrate from Sonner (route /migration-from-sonner when you run the website) for both migration paths, CSS notes, and a checklist.


New install

npm install web-haptics-toast
import { Toaster, toast } from 'web-haptics-toast';
import 'web-haptics-toast/dist/styles.css';

function App() {
  return (
    <div>
      <Toaster />
      <button onClick={() => toast('My first toast')}>Toast</button>
      <button onClick={() => toast.success('Done!')}>Success</button>
      <button onClick={() => toast.error('Failed')}>Error</button>
    </div>
  );
}

Disable haptics

<Toaster haptics={false} />

Customize haptic pattern per toast type

<Toaster
  hapticPatternMap={{
    info: 'selection',
    loading: 'light',
  }}
/>

Built-in pattern names: success, error, warning, light, medium, heavy, soft, rigid, selection, nudge, buzz.

Test haptics on desktop (play sound)

When vibration isn’t available (e.g. desktop), you can still verify patterns by playing a short sound for each pulse:

<Toaster hapticsDebug />

Use this during development to confirm which pattern runs for each toast type. On devices that support vibration, you still get real haptics; sound plays in addition when hapticsDebug is true.

Show an on-screen haptics toggle

<Toaster hapticsShowSwitch />

Renders a small built-in control so users can turn feedback on or off without you wiring custom UI.

Haptics on a button (or anywhere), not on every toast

<Toaster haptics={false}> stops toast-driven vibration. You can still call triggerHaptic from any onClick, onSubmit, shortcut handler, etc.:

import { Toaster, toast, triggerHaptic } from 'web-haptics-toast';

<Toaster haptics={false} />
<button
  type="button"
  onClick={() => {
    triggerHaptic('success');
    toast('Done');
  }}
>
  Save
</button>

You can also skip haptics for individual toasts: toast('…', { haptics: false }) while leaving <Toaster haptics /> on. Full write-up: /haptics#manual-haptics on the docs site.

Other API

  • isHapticsSupportedtrue if navigator.vibrate is available.
  • triggerHaptic(patternName, options?) – fire a built-in preset by name. Options: { intensity?: number; debug?: boolean }. Use triggerHaptic('success', { debug: true }) to hear the pattern on desktop.
  • WebHaptics – low-level class included in this package. Create instances with new WebHaptics({ debug, showSwitch }), call .trigger(input), .destroy().
  • defaultPatterns – the preset map shipped with the library (success, error, warning, light, etc.).

Sonner-style props still work the same (position, duration, theme, richColors, etc.).

Credits

Toast UX and API follow Sonner. Haptic presets and the WebHaptics model are vendored inside this repo—aligned with the ideas behind web-haptics, but not installed as a separate dependency.


License

MIT © DesignByte