Micro-interactions
Torchlight
Content hidden in darkness; the cursor is a torch that reveals only what it touches.
Install
bun add clsx tailwind-mergeThen copy 2 files into your project:
- components/registry/torchlight/torchlight.tsx
- lib/utils.ts
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| radius | number | 140 | Torch light radius. |
| softness | number | 0.5 | Falloff softness of the light edge. |
| darkness | number | 0.92 | How hidden the surrounding content is. |
| restReveal | number | 0 | Ambient reveal away from the torch. |
| smoothing | number | 0.15 | How much the light lags the cursor. |
| flicker | number | 0.15 | Subtle torch flicker (off under reduced motion). |
| torchColor | string (hex) | "#a855f7" | Amethyst torch tint. |
What It Demonstrates
- Mask
- Hiding or revealing parts of an element using a shape or gradient — like clip-path, but with soft, fadeable edges.
- Reveal
- Content is uncovered gradually, often by animating a clip-path or mask.
- Hover effect
- Visual change when the cursor moves over an element.
- Idle animation
- Subtle motion that plays while an element is just sitting there, waiting to be interacted with.
Related Components
Pixel Transition
Reveal a second layer through a random pixelated dissolve on hover.
Holofoil
Holographic trading-card foil over real content. The diffraction band travels against the tilt while the specular follows it, and the flake only lights where the rainbow currently falls, which is what stops the whole thing reading as one gradient sliding around.
Scratch
A scratch-off card. Drag over the foil to scrape it off, and small flakes fall where you scratch. Once enough foil is gone, the rest fades away on its own. A light glints across the foil now and then. You can also focus the card and press Enter or Space to reveal it.
Border Glow
A cursor-proximity gradient border with an outer glow.
Spotlight Shell
A card shell with 3D magnetic tilt, radial glow, and a shimmer sweep.
Hover List
A display-type list where a shared accent block springs between rows on hover while the text indents and inverts.