starti.app
How-to Guides

Vibrate the Device

Trigger haptic feedback on user interactions using JavaScript or CSS classes

Vibration

Give users tactile feedback by triggering device vibration on interactions — for example, when scanning a QR code, completing an action, or tapping a button.

Vibrate with JavaScript

Call vibrate() with an intensity level from 0 (low) to 3 (intense):

await startiapp.App.vibrate(0); // Low
await startiapp.App.vibrate(1); // Medium
await startiapp.App.vibrate(2); // High
await startiapp.App.vibrate(3); // Intense

Use this when you want to control exactly when vibration happens — for example, when tapping a menu item, after validating a scanned QR code, or confirming a payment.

Vibrate with CSS classes

If you just want a button or other element to vibrate when tapped, you can skip JavaScript entirely. Add one of the vibration CSS classes to the element, and the SDK handles the rest:

IntensityCSS classes
Lowstartiapp-v0, startiapp-v-l, startiapp-v-low
Mediumstartiapp-v1, startiapp-v-m, startiapp-v-medium
Highstartiapp-v2, startiapp-v-h, startiapp-v-high
Intensestartiapp-v3, startiapp-v-i, startiapp-v-intense
<button class="startiapp-v-medium">Add to cart</button>

The vibration is triggered on click — no event listeners needed.

The CSS classes work best with static HTML. If you add elements to the DOM dynamically (for example, rendering a list with JavaScript), the vibration classes may not be picked up. In that case, use the JavaScript vibrate() method instead.

See also

On this page