Skip to content
Back to Components

Parallax

@hua-labs/ui
v1.1.0

bash
npm install @hua-labs/hua
tsx
import { Parallax } from "@hua-labs/ui/advanced";

direction="up"
direction="down"
direction="left"
direction="right"

scale + opacity + rotate

speednumber0.5Parallax speed (0-1, 1 is fastest)
direction"up" | "down" | "left" | "right""up"Movement direction
offsetnumber0Starting offset in pixels
disabledbooleanfalseDisable parallax effect
scalebooleanfalseAdd scale effect based on scroll position
opacitybooleanfalseAdd opacity effect based on scroll position
rotatebooleanfalseAdd rotation effect based on scroll position
rotateDirection"cw" | "ccw""cw"Rotation direction (clockwise or counter-clockwise)

docs:common.basicUsagetsx
import { Parallax } from '@hua-labs/ui/advanced';

<Parallax speed={0.3}>
  <div className="bg-gradient-blur" />
</Parallax>
docs:components.parallax.demo.differentDirectionstsx
<Parallax direction="up" speed={0.4}>
  <div>Moves up</div>
</Parallax>

<Parallax direction="down" speed={0.4}>
  <div>Moves down</div>
</Parallax>
docs:components.parallax.demo.withEffectstsx
<Parallax speed={0.5} scale opacity rotate>
  <div className="floating-card"></div>
</Parallax>

  • Reduced Motion: Respects prefers-reduced-motion setting
  • No Content Impact: Visual effect only, does not affect content accessibility