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

Convenient methods #711

Open Spomky opened 8 months ago

Spomky commented 8 months ago

Is your feature request related to a problem? Please describe. The FlowbiteInstances.getInstance method is great, but is could be even better with convenient methods such as getModal, getCarousel, getTooltip, getDropdown and so on.

Describe the solution you'd like Add convenient methods to have somthing like as follows:

const modal = FlowbiteInstances.getModal('modal-id');
// Same as const modal = FlowbiteInstances.getInstance('Modal', 'modal-id');

Describe alternatives you've considered getInstance is fine too.

Additional context no context

zoltanszogyenyi commented 8 months ago

Hey @Spomky ,

Great idea! I'm open to this - you can also open a PR if you want to contribute and I'll have a look. The magic is in the instances.ts file.

Cheers, Zoltan