
Security News
Bun 1.2.19 Adds Isolated Installs for Better Monorepo Support
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
react-parallax-tilt
Advanced tools
Easily apply tilt hover effect on React components 👀 - inspired by vanilla-tilt.js.
npm install react-parallax-tilt
yarn add react-parallax-tilt
import React from 'react';
import ReactDOM from 'react-dom';
import Tilt from 'react-parallax-tilt';
const App = () => {
return (
<Tilt>
<div style={{ height: '300px', 'background-color': 'darkgreen' }}>
<h1>React Parallax Tilt 👀</h1>
</div>
</Tilt>
);
};
ReactDOM.render(<App />, document.getElementById('root'));
All of the props are optional.
Below is the complete list of possible props and their options:
▶︎ indicates the default value if there's one
tiltEnable: boolean ▶︎ true
Boolean to enable/disable tilt effect.
tiltReverse: boolean ▶︎ false
Reverse the tilt direction.
tiltMaxAngleX: number ▶︎ 20
Range: 0 - 90
Max tilt rotation (degrees) on x axis.
tiltMaxAngleY: number ▶︎ 20
Range: 0 - 90
Max tilt rotation (degrees) on y axis.
tiltAxis: Axis | null ▶︎ null
Axis = 'x' | 'y'
Which axis should be enabled. If null both are enabled.
tiltAngleXManual: number | null} ▶︎ null
Manual tilt rotation (degrees) on x axis.
tiltAngleYManual: number | null} ▶︎ null
Manual tilt rotation (degrees) on y axis.
glareEnable: boolean ▶︎ false
Boolean to enable/disable glare effect.
glareMaxOpacity: number ▶︎ 0.7
Range: 0 - 1
The maximum glare opacity (0.5 = 50%, 1 = 100%, etc.).
glareColor: string ▶︎ #ffffff
Set color of glare effect.
glarePosition: GlarePosition ▶︎ bottom
GlarePosition = 'top' | 'right' | 'bottom' | 'left' | 'all'
Set position of glare effect.
glareReverse: boolean ▶︎ false
Reverse the glare direction.
scale: number ▶︎ 1
Scale of the component (1.5 = 150%, 2 = 200%, etc.).
perspective: number ▶︎ 1000
The perspective property defines how far the object (wrapped/child component) is away from the user.
The lower the more extreme the tilt gets.
flipVertically: boolean ▶︎ false
Boolean to enable/disable vertical flip of component.
flipHorizontally: boolean ▶︎ false
Boolean to enable/disable horizontal flip of component.
reset: boolean ▶︎ true
If the effects has to be reset on onLeave
event.
transitionEasing: string ▶︎ cubic-bezier(.03,.98,.52,.99)
Easing of the transition when manipulating the component.
transitionSpeed: number ▶︎ 400
Speed of the transition when manipulating the component.
gyroscope: boolean ▶︎ false
Boolean to enable/disable device orientation detection.
onMove: Function => (tiltAngleX: number, tiltAngleY: number, tiltAngleXPercentage: number, tiltAngleYPercentage: number, glareAngle: number, glareOpacity: number, eventType: string | null)
Gets triggered when user moves on the component.
onEnter: Function => (eventType: string | null)
Gets triggered when user enters the component.
onLeave: Function => (eventType: string | null)
Gets triggered when user leaves the component.
Please keep in mind that detecting device orientation is currently experimental technology.
Check the browser compatibility before using this in production.
A few takeaways when using device orientation event:
https
)<iframe>
elementEasily set up a local development environment!
Build all the examples and starts storybook server on localhost:9009:
npm install
npm start
OR
Clone this repo on your machine, navigate to its location in the terminal and run:
npm install
npm link # link your local repo to your global packages
npm run build:watch # build the files and watch for changes
Clone project repo that you wish to test with react-parallax-tilt library and run:
npm install
npm link react-parallax-tilt # link your local copy into this project's node_modules
npm start
Start coding! 🎉
FAQs
Easily apply tilt hover effect on React components - lightweight/zero dependencies
The npm package react-parallax-tilt receives a total of 57,894 weekly downloads. As such, react-parallax-tilt popularity was classified as popular.
We found that react-parallax-tilt demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
Security News
Popular npm packages like eslint-config-prettier were compromised after a phishing attack stole a maintainer’s token, spreading malicious updates.
Security News
/Research
A phishing attack targeted developers using a typosquatted npm domain (npnjs.com) to steal credentials via fake login pages - watch out for similar scams.