Skip to content
Docs
Back to Components

Parallax

@hua-labs/ui
v1.1.0

Component that provides parallax effect in response to scrolling. Supports various directions, speeds, and additional effects.

설치

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

고급/Pro 컴포넌트는 @hua-labs/ui/advanced에서 제공됩니다.

UI 컴포넌트, 모션 훅, i18n을 하나의 패키지로 사용할 수 있습니다.

라이브 데모

기본 사용법

스크롤해서 패럴렉스 효과 확인

다양한 방향

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

효과 조합

scale + opacity + rotate

Props

이름타입기본값설명
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>

접근성

  • 모션 줄이기: prefers-reduced-motion 설정을 반영합니다
  • 콘텐츠 접근성 무영향: 시각적 효과에만 영향을 미치며 콘텐츠 접근성에는 영향을 주지 않습니다