Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Another React Flipcard, based on @mzabriskie’s react-flipcard, but with support for React v16, and some other considerations for the Mort Modern type specimen site.


npm install --save @kennethormandy/react-flipcard


import React from 'react'
import { render } from 'react-dom'
import Flipcard from '@kennethormandy/react-flipcard'

// Import minimal required styles however you’d like
import '@kennethormandy/react-flipcard/dist/Flipcard.css'

class App extends React.Component {
  constructor() {

    this.state = {
      flipped: false,

  render() {
    return (
        <button onClick={e => this.setState({ flipped: !this.state.flipped })}>
        <Flipcard flipped={this.state.flipped}>

render(<App />, document.getElementById('target'))

Transition Type


<Flipcard type="horizontal">

Revolving Door

<Flipcard type="revolving-door">

Conditional two-column example

Gif showing the two-column layout turning into a Flipcard below a certain breakpoint.

Like in the Mort Modern type specimen site, it’s possible to change or disable the minimal Flipcard styles at certain breakpoints. This can be done entirely through CSS, but you might also want to use matchMedia to change some other part of your user interface (ex. disabling the button).

      <h2>Column 1</h2>
      <p>The main column on small viewports.</p>
      <h2>Column 2</h2>
      <p>Flip to see me on smaller viewports.</p>

Within your CSS, you might do something like this:

/* If the viewport is wide enough: */
@media (min-width: 750px) {

  /* Use the flipper as a Flexbox container: */
  .Flipcard-flipper {
    display: flex;
    transform: none !important;

  /* Show both cards and remove the transitions: */
  .Flipcard-back {
    position: relative;
    transform: none !important;
    opacity: 1 !important;

Importing styles

People have a lot of different opinions about how to manage styles alongside React. The guideline I have decided to follow is that my approach should work with a fresh Create React App setup, and not impose another dependency.

If you’d like the styles already minified and autoprefixed, import the CSS from dist:

import '@kennethormandy/react-flipcard/dist/Flipcard.css'

If you’re already running things through your own CSS build process that’s going to do those things anyway, you might want to import the styles from src instead. Then, the source maps will map back to your CSS before minification, too:

import '@kennethormandy/react-flipcard/src/Flipcard.css'

You can also path to these files from Sass, PostCSS, or another CSS build process. The styles are also quite minimal and you might want to change them, so there’s nothing wrong with copying and building on the CSS partial yourself rather than using the provided styles directly.



The MIT License (MIT)

Copyright © 2017–2018 Kenneth Ormandy Inc.