Giter VIP home page Giter VIP logo

vue-flipper's Introduction

vue-flipper

License Library size Dependencies FOSSA Status

A component to flip elements with a nice transition.

vue-flipper GIF

  • โšก It is really small, JavaScript + CSS (min + gzip) is smaller than 1KB

  • ๐ŸŽจ CSS uses Stylus + BEM + Autoprefixer

  • ๐Ÿ“ฆ There are ESM, CommonJS and UMD distributions

You can se by youself on Codepen or CodeSandbox.

Installation

This library is published in the NPM registry and can be installed using any compatible package manager.

npm install vue-flipper --save

# For Yarn, use the command below.
yarn add vue-flipper

Usage

Just import Flipper component from 'vue-flipper' and use it like any other Vue component.

<template>
  <flipper
    width="270px"
    height="300px"
    :flipped="flipped"
    @click="onClick"
  >
    <div slot="front">Frontface</div>

    <div slot="back">Backface</div>
  </flipper>
</template>

<script>
import Flipper from 'vue-flipper';

export default {
  components: { Flipper },
  data () {
    return {
      flipped: false
    };
  },
  methods: {
    onClick () {
      this.flipped = !this.flipped;
    }
  }
};
</script>

<style src="vue-flipper/dist/vue-flipper.css" />

Usage as global component

If you need <flipper /> available everywhere, you can register it as a global component.

And don't forget to import its CSS.

import 'vue-flipper/dist/vue-flipper.css';
import Vue from 'vue';
import Flipper from 'vue-flipper';

Vue.component('flipper', Flipper);

Usage from CDN

vue-flipper has an UMD bundle and CSS available through JSDelivr and Unpkg CDNs.

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vue-flipper/dist/vue-flipper.css" />

<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script src="https://cdn.jsdelivr.net/npm/vue-flipper"></script>

<script>
  /**
   * vue-flipper is available through VueFlipper.
   */
  console.dir(VueFlipper);

  /**
   * Vue.use will add flipper as global component.
   */
  Vue.component('flipper', VueFlipper);
</script>

Props

Name Description Type Default
flipped If true flips to backface, otherwise to frontface. Boolean false
width Component's width. CSSLength (String) '100%'
height Component's height. CSSLength (String) '100%'
duration Component's transition duration. CSSTime (String) '0.5s'
transition Component's transition timing function. CSSTransitionFunction (String) 'ease-in'

Events

Flipper component pass up every HTMLElement event. So, you can use @click, @mouseover etc.

License

Released under MIT License.

FOSSA Status

vue-flipper's People

Contributors

fossabot avatar vitorluizc avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.