Create a Card component with React and styled-components

0xkoji

0xkoji

Posted on July 30, 2021

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

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
  • Event tracking for 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: 'darkgreen' }}>
        <h1>
…
Enter fullscreen mode Exit fullscreen mode

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

πŸ’– πŸ’ͺ πŸ™… 🚩
0xkoji
0xkoji

Posted on July 30, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related