flowbite icon indicating copy to clipboard operation
flowbite copied to clipboard

About npm `import 'flowbite'` related issues

Open daxiongYang opened this issue 2 years ago • 1 comments

When importing the js library through npm import 'flowbite'.

  1. Is it optional? Like: import { Modal } form 'flowbite' . Although, I can
import Accordion from 'flowbite/src/components/accordion'
import Collapse from 'flowbite/src/components/collapse'
import Carousel from 'flowbite/src/components/carousel'
import Dismiss from 'flowbite/src/components/dismiss'
import Dropdown from 'flowbite/src/components/dropdown'
import Modal from 'flowbite/src/components/modal'
import Tabs from 'flowbite/src/components/tabs'
import Tooltip from 'flowbite/src/components/tooltip'

But I feel so innocent! !

  1. Can you provide a namespace instead of directly window.Modal = Modal; to bind the Class to the window object?

daxiongYang avatar Jun 30 '22 02:06 daxiongYang

Hey @daxiongYang,

I'll take a look at this. Thanks for reporting.

zoltanszogyenyi avatar Jul 01 '22 12:07 zoltanszogyenyi

Hello @daxiongYang,

Since v1.5.5 you can now import flowbite and then use something like flowbite.Modal instead of the window object.

Here's the source code of the exports: https://github.com/themesberg/flowbite/blob/main/src/flowbite.js

Cheers, Zoltan

zoltanszogyenyi avatar Dec 10 '22 10:12 zoltanszogyenyi