floating-ui-svelte icon indicating copy to clipboard operation
floating-ui-svelte copied to clipboard

Add: useTransition hook

Open endigo9740 opened this issue 1 year ago • 2 comments

Reference

https://floating-ui.com/docs/useTransition

Description

Provides the ability to apply CSS transitions to a floating element, including correct handling of “placement-aware” transitions.

Style Props

  • [ ] duration
  • [ ] initial
  • [ ] close
  • [ ] open
  • [ ] common
  • [ ] Scale transforms

Status

  • [ ] Asymmetric transitions
  • [ ] Placement-aware transitions

Status Props

  • [ ] duration

endigo9740 avatar Apr 25 '24 00:04 endigo9740

I'm curious what the reason is to create this hook instead of leveraging Svelte's built in transition directive? Is it because of placement-aware transitions?

Hugos68 avatar May 09 '24 11:05 Hugos68

@Hugos68 I think there's two main benefits:

  1. It enables custom CSS class-based animations. Svelte transitions are cool, but they are a bit more complicated to setup and use.
  2. As you mention, they would not have access to placement-aware transitions. So if the popover flips position, this won't affect the Svelte transition which will likely animate the same (ex: slide down where it's supposed to slide up, etc)

endigo9740 avatar May 09 '24 14:05 endigo9740