New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-flippy

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-flippy

latest
Source
npmnpm
Version
1.1.0
Version published
Weekly downloads
916
-1.29%
Maintainers
1
Weekly downloads
 
Created
Source

React-Flippy

React-Flippy allows you to create flipping cards in React projects. It can be used as controlled or uncontrolled component.

Vertical

Horizontal

Live Demo

How to install ?

npm install react-flippy or yarn add react-flippy

How to use ?

import { useRef } from 'react';
import Flippy, { FrontSide, BackSide } from 'react-flippy';
import Flippy, { FrontSide, BackSide } from 'react-flippy';

function Sample() {
  const ref = useRef();
  return (
    <Flippy
      flipOnHover={false} // default false
      flipOnClick={true} // default false
      flipDirection="horizontal" // horizontal or vertical
      ref={ref} // to use toggle method like ref.curret.toggle()
      // if you pass isFlipped prop component will be controlled component.
      // and other props, which will go to div
      style={{ width: '200px', height: '200px' }} /// these are optional style, it is not necessary
  >
    <FrontSide style={{ backgroundColor: '#41669d'}} >
      RICK <br />
      <button onClick={() => { ref.current.toggle(); }}> Toggle via button</button>
    </FrontSide>
    <BackSide style={{ backgroundColor: '#175852'}}>
      ROCKS
    </BackSide>
  </Flippy>
  )
}

API for Components

Flippy

Prop NameDescriptionValuesDefault
flipDirectionDirection of flip effecthorizontal/verticalhorizontal
flipOnHoverShould card flip on mouse hovertrue/falsefalse
flipOnClickShould card click on mouse click/touchtrue/falsetrue
isFlippedIf you pass isFilipped prop component will be "controlled react component" and flipOnHover, flipOnClick functions will not work. You must handle this functionalities with your own logic.undefined/true/falseundefined
...propsOther props will be passed to container.

Note: Flippy component has a function named "toggle" in its reference.

FrontSide

Prop NameDescriptionValuesDefault
animationDurationDuration of flip animation, should be used equal with back side for a good view.number600
elementTypeDom element type for carddom element typesdiv
...propsOther props will be passed to card.

BackSide

Prop NameDescriptionValuesDefault
animationDurationDuration of flip animation, should be used equal with front side for a good view.number600
elementTypeDom element type for carddom element typesdiv
...propsOther props will be passed to card.

Notes

To run sample project, clone the repository and run yarn && yarn start To build project, clone repository and run yarn && yarn build

Changelog

1.0.0 (10 May, 2021)

  • React updated to 17.0.2
  • Component converted to react-hook
  • Dependencies upgraded
  • Fixed bugs

0.1.5 New build system targeting es5 modules.

Credits

Thanks to: https://github.com/fffilo/flipper I have used same methodology for style management.

FAQs

Package last updated on 09 May 2021

Did you know?

Socket

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.

Install

Related posts