[Feat]: Add data attributes plugin #1051
Replies: 2 comments 15 replies
-
Hi @DanielSusanu, I think this is a good idea! But at the time of writing, I'm not sure how to solve this in an optimal way. The Feel free to share your thoughts. |
Beta Was this translation helpful? Give feedback.
-
Hi @davidjerleke, Thanks for considering this feature. I believe keeping these as two separate plugins is the best approach, as it aligns with the single-purpose design approach of the existing plugins in the library. Combining the two functionalities would lead to a more complex codebase and would likely require renaming the plugin to describe both purposes. Creating an additional DataAttributes plugin that initially shares most of the logic with the ClassNames plugin will be more straightforward. This will result in clearer, more maintainable code that focuses solely on data attribute handling. This approach allows developers to easily choose between using class names, data attributes, or both, based on their needs. Let me know what you think. |
Beta Was this translation helpful? Give feedback.
-
Which variants of Embla Carousel are relevant to this feature request?
Feature description
I am proposing the addition of a DataAttributes plugin that dynamically adds and removes custom HTML data attributes on the carousel and its slides based on various states and events. This would work similarly to the existing ClassNames plugin but would manipulate data attributes (data-*) instead of CSS classes.
Additional Context
The DataAttributes plugin would:
I will be happy to contribute or fully implement this plugin.
Thank you for considering this feature request. I believe it will be a valuable addition to the ecosystem and enhance the way the carousel is integrate with modern CSS frameworks.
Before submitting
Beta Was this translation helpful? Give feedback.
All reactions