1.1.1 • Published 3 months ago

@mcjumaah/zero-trans-to-auto v1.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
3 months ago

zero-trans-to-auto

Vue Component to Transition sizes(width, height) from 0 to auto. Not really, but we can get the same result by utilizing Grid.

https://www.npmjs.com/package/@mcjumaah/zero-trans-to-auto

The Problem:

Normally, we can't transition elements from height/width of 0 to auto.

Reference

My reference to the approach I utilized in this component is mainly from the YT video of Kevin Powell:

Get started

Zero Transition To Auto

Install:

npm install @mcjumaah/zero-trans-to-auto

Then, import and register the component. The component itself does not include any CSS. You'll need to include it separately for the component to work

// main.ts or main.js

import { createApp } from "vue";
import App from "./App.vue";

import ZeroTransToAuto from "@mcjumaah/zero-trans-to-auto";
import "@mcjumaah/zero-trans-to-auto/styles.css";

createApp(App)
    .use(ZeroTransToAuto);
    .mount("#app");

Then insert the element you want to transition inside the component:

<template>
  <div>
    <ZeroTransToAuto> Insert Elements Here </ZeroTransToAuto>
  </div>
</template>

Props

PropDescriptionTypeDefault
childClass.zero-to-auto-container's child 's custom classstring-
isOpenindicate the status of the component if it's openbooleanfalse
transitionDirectionAxisinput 'y' for y-axis (i.e., vertical transition), 'x' for x-axis (i.e., horizontal transition)string'y'
isOnHoverto transition when hovered by the cursorbooleantrue
disableDefaultBgColorremove the default background color (i.e., gray). You can put your custom background color on customClass propbooleanfalse
disableDefaultPaddingremove the default padding (i.e., 10px). You can put your custom padding on customClass propbooleanfalse
disableDefaultTransitionAllremove the default transition (i.e., transition-property: all; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms;). You can put your custom transition on customClass propbooleanfalse
disableWidthFitremove the default width (i.e., fit-content). You can put your custom width on customClass propbooleanfalse
1.1.1

3 months ago

1.1.0

3 months ago

1.0.1

3 months ago

1.0.0

3 months ago