DEV Community

Cover image for Create a Card component with React and styled-components
0xkoji
0xkoji

Posted on • Updated on

Create a Card component with React and styled-components

https://codesandbox.io/s/nameless-worker-z31nt

Added the tilt effect to cards by react-parallax-tilt

GitHub logo mkosir / react-parallax-tilt

πŸ‘€ Easily apply tilt hover effect on React components - lightweight/zero dependencies (3kB)

React Tilt

npm version npm downloads npm bundle size Open issues TypeScript semantic-release

CI CI CI CI CI Codecov Coverage

CI CI

πŸ‘€ Easily apply tilt hover effect on React components

Demo πŸ’₯

Install

npm install react-parallax-tilt
Enter fullscreen mode Exit fullscreen mode

Features

  • Lightweight (β‰ˆ3kB), zero dependencies πŸ“¦
  • Tree-shakable 🌳 ESM and CommonJS support
  • Works with React v15 onwards
  • Supports mouse and touch events
  • Support for device tilting (gyroscope)
  • Glare effect 🌟 with custom props (color, position,...) πŸ”—demo
  • Events to keep track of component values πŸ“ (tilt, glare, mousemove,...) πŸ”—demo
  • Many effects that can be easily applied

Example

import React from 'react';
import ReactDOM from 'react-dom';
import Tilt from 'react-parallax-tilt';
const App = () => {
  return (
    <Tilt>
      <div style={{ height: '300px', backgroundColor
…
Enter fullscreen mode Exit fullscreen mode

https://codesandbox.io/embed/nameless-worker-z31nt?fontsize=14&hidenavigation=1&theme=dark

Top comments (0)