vueuse / motion

๐Ÿคน Vue Composables putting your components in motion
https://motion.vueuse.org
MIT License
2.13k stars 75 forks source link

[DRAFT] feat: configurable `<MotionGroup>` child element variants using `:config-fn` prop #193

Open BobbieGoede opened 1 month ago

BobbieGoede commented 1 month ago

๐Ÿ”— Linked issue

โ“ Type of change

๐Ÿ“š Description

This is built on https://github.com/vueuse/motion/pull/192.

This draft can be considered a feature proposal, its usefulness can be previewed in the updated docs with the following example of how easy a staggered animation would look like:

<MotionGroup preset="slideVisibleLeft" :config-fn="(index) => ({ delay: index * 200 })">
  <section>
    <h3>Product 1</h3>
    <p>Description text</p>
  </section>
  <section>
    <h3>Product 2</h3>
    <p>Description text</p>
  </section>
  <section>
    <h3>Product 3</h3>
    <p>Description text</p>
  </section>
</MotionGroup>

Not sure about the name of the prop, still need to add tests as well, feedback is appreciated!

๐Ÿ“ Checklist