ycs77 / headlessui-float

Easily use Headless UI with Floating UI to position floating elements.
https://headlessui-float.vercel.app
MIT License
344 stars 12 forks source link

Using transition name #15

Closed samuveth closed 1 year ago

samuveth commented 1 year ago

It would be great if it was possible to use transition name instead of having to repeat all my transition styling each time I use Float.

Example of how I usually do it in Vue:

<Transition name="fade">

// Fade transition for Vue's transition and transition-group
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.2s ease;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}
ycs77 commented 1 year ago

Released in v0.8.0

Usage

Use named transition classes to define transition styles:

<Float transition-name="fade">

Then you can be add the classes:

<style>
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.5s ease;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}
</style>
samuveth commented 1 year ago

@ycs77 that was fast :)