All Projects → BinarCode → Vue2 Transitions

BinarCode / Vue2 Transitions

✨ Reusable Vue 2 transition components

Projects that are alternatives of or similar to Vue2 Transitions

Semantic Ui Vue
Semantic UI integration for Vue
Stars: ✭ 914 (+27.3%)
Mutual labels:  components, vuejs2
Vue Form Json Schema
Create forms using JSON schema. Bring your components!
Stars: ✭ 253 (-64.76%)
Mutual labels:  components, vuejs2
Pd Select
vue components ,like ios 3D picker style,vue 3d 选择器组件,3D滚轮
Stars: ✭ 101 (-85.93%)
Mutual labels:  components, vuejs2
Vue Transitions Css
A lightweight CSS library for adding transitions to Vue components ✨ 💚
Stars: ✭ 26 (-96.38%)
Mutual labels:  transitions, vuejs2
Vue Generate Component
Vue js component generator
Stars: ✭ 206 (-71.31%)
Mutual labels:  components, vuejs2
Vue Goodshare
🍿 Vue.js component for social share. A simple way to share a link on the pages of your website in the most popular (and not so) social networks. Powered by goodshare.js project.
Stars: ✭ 345 (-51.95%)
Mutual labels:  components, vuejs2
Vue Burger Menu
🍔 An off-canvas sidebar Vue component - https://vue-burger-menu.netlify.com/
Stars: ✭ 648 (-9.75%)
Mutual labels:  vuejs2
Vue Webpack Typescript
A Vue, Webpack, Typescript, Bootstrap setup with hot reload, dynamic imports, unit testing, code coverage, sass, uncss and bundling/minification.
Stars: ✭ 677 (-5.71%)
Mutual labels:  vuejs2
Ramjet
Morph DOM elements from one state to another with smooth animations and transitions
Stars: ✭ 5,455 (+659.75%)
Mutual labels:  transitions
Frend.co
Frend — A collection of accessible, modern front-end components.
Stars: ✭ 640 (-10.86%)
Mutual labels:  components
Vue Instantsearch
👀 Algolia components for building search UIs with Vue.js
Stars: ✭ 707 (-1.53%)
Mutual labels:  components
Iview
A high quality UI Toolkit built on Vue.js 2.0
Stars: ✭ 23,930 (+3232.87%)
Mutual labels:  components
Vue Wordpress Pwa
An offline-first SPA using Vue.js, the WordPress REST API and Progressive Web Apps
Stars: ✭ 665 (-7.38%)
Mutual labels:  vuejs2
Vuebar
(🗃️ Archived) Vue 2 directive for custom scrollbar that uses native scroll behavior. Lightweight, performant, customizable and without dependencies. Used successfully in production on https://ggather.com
Stars: ✭ 650 (-9.47%)
Mutual labels:  vuejs2
Bloomer
A set of React components for Bulma CSS Framework
Stars: ✭ 683 (-4.87%)
Mutual labels:  components
Vue Virtual Scroller
⚡️ Blazing fast scrolling for any amount of data
Stars: ✭ 6,326 (+781.06%)
Mutual labels:  vuejs2
Reef
A lightweight library for creating reactive, state-based components and UI.
Stars: ✭ 700 (-2.51%)
Mutual labels:  components
Shards React
⚛️A beautiful and modern React design system.
Stars: ✭ 639 (-11%)
Mutual labels:  components
Vue Hotel Datepicker
Vue date range picker component
Stars: ✭ 665 (-7.38%)
Mutual labels:  vuejs2
Design System Components
🛠 Component code and tests for the Australian Government design system
Stars: ✭ 696 (-3.06%)
Mutual labels:  components

vue2-transitions

Demo

Codesandbox

NPM version NPM downloads CircleCI

✨ Reusable component transitions

Why ❓

  • Brings only the code that you need. Many alternative solutions import the whole animate.css library. Vue2-transitions is minimalistic and lets you import only the transitions that you need in your app

    Each transition component has ~2kb (non-minified js+css or ~400 bytes gzipped) and you can import only the ones you really need.

  • Configurable. You can configure animation enter and leave durations as well as all the props of the native Vue transition components through props

  • Easy to use. No extra classes

Install ☕️

npm i vue2-transitions
yarn add vue2-transitions

CDN: UNPKG | jsDelivr (available as window.Vue2Transitions)

Usage 🚀

<template>
   <fade-transition>
      <div class="box" v-show="show">
        <p>Fade transition</p>
      </div>
    </fade-transition>
</template>

<script>
import {FadeTransition} from 'vue2-transitions'

export default {
  components: {
    FadeTransition
  }
}
</script>

Global usage

import Transitions from 'vue2-transitions'
Vue.use(Transitions)

List of available transitions

  • FadeTransition
  • ZoomCenterTransition
  • ZoomXTransition
  • ZoomYTransition
  • CollapseTransition
  • ScaleTransition
  • SlideXLeftTransition
  • SlideXRightTransition
  • SlideYUpTransition
  • SlideYDownTransition

Props

props: {
  /**
   * Transition duration. Number for specifying the same duration for enter/leave transitions
   * Object style {enter: 300, leave: 300} for specifying explicit durations for enter/leave
   */
  duration: {
    type: [Number, Object],
    default: 300
  },  
  /**
   * Whether the component should be a `transition-group` component.
   */
  group: Boolean,
  /**
   * Transition tag, in case the component is a `transition-group`
   */
  tag: {
    type: String,
    default: 'span'
  },
  /**
   *  Transform origin property https://tympanus.net/codrops/css_reference/transform-origin/.
   *  Can be specified with styles as well but it's shorter with this prop
   */
  origin: {
    type: String,
    default: ''
  },
  /**
   * Element styles that are applied during transition. These styles are applied on @beforeEnter and @beforeLeave hooks
   */
  styles: {
    type: Object,
    default: () => {
      return {
        animationFillMode: 'both',  
        animationTimingFunction: 'ease-out'
      }
    }
  }
}

Group transitions

Each transition can be used as a transition-group by adding the group prop to one of the desired transitions.

<fade-transition group>
   <!--keyed children here-->
</fade-transition>

Gotchas/things to watch:

  1. Elements inside group transitions should have display: inline-block or must be placed in a flex context: Vue.js docs reference
  2. Each transition has a move class move class docs. Unfortunately the duration for the move transition cannot be configured through props. By default each transition has a move class associated with .3s transition duration:
  • Zoom
     .zoom-move{
       transition: transform .3s ease-out;
     }
    
  • Slide
      .slide-move{
        transition: transform .3s ease-out;
      }
    
  • Scale
     .scale-move{
         transition: transform .3s cubic-bezier(.25,.8,.50,1);
       }
    
  • Fade
    .fade-move{
        transition: transform .3s ease-out;
      }
    

If you want to configure the duration, just redefine the class for the transition you use with the desired duration.

Contribution

Defining a new transition

The codebase is fairly simple and contains mostly .vue components. If you want to add a new transition to the collection follow these steps:

  1. Fork the repo.
  2. Create a new branch.
  3. Create a new .vue file (together with a folder if necessary)
  4. Define the transition.
     <template>
       <component :is="componentType"
                   v-bind="$attrs"
                   v-on="hooks"
                   enter-active-class="enterAnimationClassHere"
                   move-class="move-class"
                   leave-active-class="leaveAnimationClassHere">
         <slot></slot>
       </component>
     </template>
     <script>
       import {baseTransition} from '../mixins/index.js'
       export default {
         name: 'transition-name-here',
         mixins: [baseTransition]
       }
     </script>
     <style>
      // Your styles for animations here.
     </style>
    
  5. Import the transition in src/index.js and place it in the export default object.
  6. Add the name of the new transition (camelCase) in the transitionOptions array inside example/App.vue

Besides the properties described above, you can pass in any other Transition props or events Note Overriding hooks (especially beforeEnter or beforeLeave) may cause unwanted effects.

License

MIT © cristijora

Special thanks to

@euvl (The UI for list transitions in the demo is inspired by vue-js-grid demo )

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].