themesberg / flowbite

Open-source UI component library and front-end development framework based on Tailwind CSS
https://flowbite.com
MIT License
7.35k stars 711 forks source link

Allow to define a 3rd param for `options` with 2.0's Instance Manager #693

Closed alessandro-newzoo closed 5 months ago

alessandro-newzoo commented 8 months ago

Is your feature request related to a problem? Please describe.

I'm so glad you are now allowing us to target objects created through data attributes, so thank you SO much for that! Sadly though it looks like it's not accepting a third parameter for assigning the object some options, is that right?

Describe the solution you'd like

I'd love for this to accept a third param so we can define options, otherwise I'm again back to square 1 and I can't customize any object created through data attr.

An example of how it should work:

const id = $('.accordion').attr('id');
const options = {
    alwaysOpen: true,
    activeClasses: 'accordion--item--active',
};

const accordion = FlowbiteInstances.getInstance('Accordion', id, options);

but right now options is not doing anything, since from what I can gather from your docs, FlowbiteInstances.getInstance only accepts two parameters.

I hope you will prove me wrong, but if not, do you think this is something that could be implemented?

Thank you and happy Friday! Alessandro

alessandro-newzoo commented 8 months ago

Of course 1 minute after posting this I found out you can customize those by using attrs like data-active-classes= etc, so I'm quite happy with this but it would still be great if we could do this via JS to keep our HTML a bit cleaner :)