BloxwapHaptic

Presets and patterns

Eleven feedback presets and four ways to describe custom vibration.

PresetResponse
selectionSmall tick
lightGentle tap
mediumFirmer tap
heavyStrong tap
softSofter response
rigidShort, crisp tap
successConfirmation pattern
warningTwo-tap warning
errorThree taps
nudgeStrong tap followed by soft tap
buzzLonger vibration

Presets retain the pinned web-haptics definitions and use the shared bounded encoder. Explicit preset intensities override the default supplied through triggerOptions.intensity. The demo slider is therefore labeled “Custom pattern intensity.” Duration, patterns, and intensity apply on vibration-capable browsers. Opted-in native iOS interactions use the same system tick for every preset.

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

// One duration in milliseconds.
<Haptic feedback={80}><button>Single</button></Haptic>;

// Alternating vibration, pause, vibration.
<Haptic feedback={[30, 60, 30]}><button>Two taps</button></Haptic>;

// Event durations with delay and intensity.
<Haptic feedback={[{ duration: 30, intensity: 0.8 }, { delay: 60, duration: 30 }]}>
  <button>Custom events</button>
</Haptic>;

// A reusable preset object.
<Haptic feedback={{ pattern: [{ duration: 30 }, { delay: 60, duration: 30 }] }}>
  <button>Custom preset</button>
</Haptic>;

Hardware and browser limits can alter a pattern's physical response. Intensity is an engine approximation, not a promise of precise actuator amplitude. Keep feedback brief and optional for users.

Edit on GitHub