Vue Slide Up Down Transition Component

3.0.0 · active · verified Sun Apr 19

Vue Slide Up Down provides a Vue component for animating height transitions, mimicking the `slideUp` and `slideDown` effects found in jQuery. The current stable version is 3.0.0, which offers full compatibility with Vue 3. While there isn't a strict release cadence, updates are primarily driven by compatibility with major Vue versions and community contributions. Key differentiators include its simple, declarative API via the `active` prop, support for custom durations, and control over the wrapper HTML tag and the `hidden` attribute. It also emits detailed events for animation lifecycle stages, allowing for fine-grained control and integration into complex UIs. The library focuses on providing a robust and accessible solution for vertical content transitions within Vue applications.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to import and globally register `SlideUpDown` in a Vue 3 application. It shows a basic toggle button that controls the visibility of a content block using the component's `active` prop, including dynamic content and an input field to demonstrate accessibility.

import { createApp, ref } from 'vue';
import SlideUpDown from 'vue-slide-up-down';

const app = createApp({
  template: `
    <div>
      <button @click="toggleActive">Toggle Content</button>
      <slide-up-down :active="isActive" :duration="800" class="my-slide-transition">
        <div v-if="isActive" style="padding: 15px; border: 1px solid #eee; background-color: #f9f9f9;">
          <h2>Animated Content</h2>
          <p>This content slides up and down. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Adipisci, minima?</p>
          <input type="text" placeholder="Interactive element">
        </div>
      </slide-up-down>
    </div>
  `,
  setup() {
    const isActive = ref(false);
    const toggleActive = () => {
      isActive.value = !isActive.value;
    };
    return { isActive, toggleActive };
  }
});

app.component('slide-up-down', SlideUpDown);
app.mount('#app');

view raw JSON →