BloxwapHaptic

Get started

Add feedback to a React target without replacing its behavior.

Haptic adds feedback to React and React Native. On the web, it preserves the original target by default; native apps use Expo Haptics. See the release evidence and platform certification status.

Install

npm install @bloxwap/haptic

React and React DOM are peers. Use matching versions, React 18 or 19. The package provides ESM, CommonJS, and TypeScript declarations.

Wrap one target

import { Haptic } from '@bloxwap/haptic';

export function SaveButton() {
  return (
    <Haptic feedback="success">
      <button onClick={() => console.log('Saved')}>Save</button>
    </Haptic>
  );
}

Your element keeps its handlers, ref, focus, and accessibility attributes. The wrapper defaults to inline-grid; className and style control its layout.

Device behavior

On supported physical iOS devices, explicitly setting iosPhysicalTap enables the system tick. The default preserves the original events and stays silent there; read the overlay limitations before opting in. Vibration-capable browsers use the selected preset or pattern. On a desktop without vibration hardware, webHapticsOptions={{ debug: true }} enables audio preview.

Physical feedback depends on device support and settings. The platform guide separates interaction tests from physical-device certification.

Disable feedback

import { Haptic } from '@bloxwap/haptic';
const save = () => console.log('Saved');

<Haptic enabled={false}>
  <button onClick={save}>Save without feedback</button>
</Haptic>

Disabling feedback leaves the original action available. A target with disabled or aria-disabled="true" does not request feedback.

Next.js

Put interactive examples in a client component with 'use client'. The published build preserves its client boundary and still renders safely through React server rendering. Platform detection resolves on the first client-only render. Hydrated renders keep the server routing value until hydration completes so initial markup agrees.

Edit on GitHub

On this page