MenuClose

Elastic Hover — React Interaction

Rubber around whatever you wrap: hovering swells it, pressing squashes it wide, and an under-damped spring snaps it back with a wobble.

View source
PreviewReact
Starting live preview

Usage

import { ElasticHover } from "@/components/ElasticHover";

export function Button() {
  return <ElasticHover grow={0.05} squash={0.12}
    {...{
      grow: 0.05,
      squash: 0.12
    }}
  ><button type="button">Press me</button></ElasticHover>;
}
Implementation notes & API

Accepts children, grow, squash, stiffness, damping, disabled, className and style. The inner element keeps its own semantics — buttons stay buttons, links stay links — and reduced motion leaves the content perfectly still. Works without WebGPU.

PropertyTypeNotes / default
childrenReactNodeYour own content; the default is a demonstration
disabledbooleanfalse; motion also respects system preferences
className / stylestring / CSSPropertiesApplied to the outer container
View source on GitHubFree for commercial projects · MIT