BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/lyminhnghia/haptic

Haptic Feedback

lyminhnghia/haptic
FreeUtility

Trigger haptic feedback on mobile devices.

Install it

npx shadcn@latest add https://lyminhnghia.github.io/r/haptic.json

Source

src/registry/lib/haptic/haptic.tslyminhnghia.github.io/r/haptic.json
1const isTouchDevice =
2 typeof window !== "undefined"
3 ? window.matchMedia("(pointer: coarse)").matches
4 : false
5
6/**
7 * Trigger haptic feedback on mobile devices.
8 * Uses Vibration API on Android/modern browsers, and iOS checkbox trick on iOS.
9 *
10 * @param pattern - Vibration duration (ms) or pattern.
11 * Custom patterns only work on Android devices. iOS uses fixed feedback.
12 * See [Vibration API](https://developer.mozilla.org/docs/Web/API/Vibration_API)
13 *
14 * @example
15 * import { haptic } from "@/lib/haptic"
16 *
17 * <Button onClick={() => haptic()}>Haptic</Button>
18 */
19export function haptic(pattern: number | number[] = 50) {
20 try {
21 if (!isTouchDevice) return
22
23 if ("vibrate" in navigator) {
24 navigator.vibrate(pattern)
25 return
26 }
27
28 // iOS haptic trick via checkbox switch element
29 const label = document.createElement("label")
30 label.ariaHidden = "true"
31 label.style.display = "none"
32
33 const input = document.createElement("input")
34 input.type = "checkbox"
35 input.setAttribute("switch", "")
36 label.appendChild(input)
37
38 try {
39 document.head.appendChild(label)
40 label.click()
41 } finally {
42 document.head.removeChild(label)
43 }
44 } catch {}
45}

Files it writes

  • src/registry/lib/haptic/haptic.ts

Facts

Registry
lyminhnghia
Type
registry:lib
Access
Free
Files written
1
Licence
MIT
In the index
at or before 2026-08-10
Last confirmed
today

Go to the source

lyminhnghia.github.io lyminhnghia/lyminhnghia.github.io on GitHub Raw registry item This item as JSON

More from lyminhnghia

All 26 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Utility FunctionsutilslyminhnghiaUtilitiesFree2 deps

Also from Kynth Studios

Built for the same person as BlockDex

SkillWorks

Claude Code skills and plugins, scored

skillworks.kynth.studio

RuleStack

AGENTS.md gallery and agent-config comparison

rulestack.kynth.studio

ToolDrift

What the AI coding tools changed last night

tooldrift.kynth.studio

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex