Back to AIX Effects LibraryQA Verified · Synced
Interactive Components/<MagneticButton />·Advanced

Magnetic Button

Prevents boundary feedback oscillation by anchoring spring proximity relative to unshifted resting button center.

Next.js 16+React 19TypeScriptTailwind CSSZero External Deps
R=145px · k=0.14Approach & Click

Sweep pointer inside magnetic proximity field or click to emit rebound ripple.

Installation

Zero External Dependencies

Zero external dependencies — paste MagneticButton.tsx paired with magnetic-button.css.

Usage

import { MagneticButton } from '@/components/effects/library/interactive/MagneticButton'

<MagneticButton
  magneticRadius={145}
  pullStrength={0.38}
  innerParallaxRatio={0.52}
  onClick={() => console.log('Launched')}
>
  Khởi chạy AI Workspace →
</MagneticButton>

Props & API Reference

5 props
PropTypeDefaultDescriptionEffect
magneticRadiusnumber145Attraction proximity halo radius around button anchor in pixels.Expands pointer pickup zone.
pullStrengthnumber0.38Displacement scaling strength ratio.Controls how aggressively button tracks pointer.
innerParallaxRationumber0.52Relative inner label travel fraction versus shell displacement.Enhances layered tactile depth perception.
stiffnessnumber0.14Hooke spring force constant.Adjusts spring responsiveness.
dampingnumber0.76Velocity friction factor (0.55 - 0.90).Controls spring settle overshoot.

More in Interactive Components

View All 36 →
Move pointer or tap cells to illuminate hairline grid
01
Pointer Tracking
02
Masked Grid
03
Touch Ready
04
Zero Packages
Beam 280px · Grid 28px

Cursor Spotlight

Radial light container uncovering masked hairline coordinates cleanly under pointer.

View Details
Select tabs across uneven label widths
active: overview · stiffness 400

Fluid Navigation Indicator

Dynamic width spring capsule gliding smoothly between navigation tabs via scoped layoutId.

View Details
Hover or swipe edges from all 4 directions
01
Top / Bottom Entry
Cross top or bottom edge
01
Top / Bottom Entry

Vector atan2 slides glass panel along crossed edge.

02
Left / Right Entry
Cross left or right border
02
Left / Right Entry

Aspect-normalized quad detection stays true on wide cards.

duration: 0.28s

Direction-Aware Hover

Detects pointer crossing edge via atan2 geometry and slides scrim along exact side.

View Details