themesberg / flowbite

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

datepicker causing error in ssr in the version v2.4.1 (document is not defined) #921

Closed tawfikyassine closed 2 days ago

tawfikyassine commented 3 days ago

Capture d’écran 2024-07-04 120913

version with problem : v2.4.1

there is no problem with this version : v2.3.0

Im using Vuejs3 with laravel using inertiajs ssr

Rubanrubi commented 3 days ago

same issue need solution i am using angular v18 image

zoltanszogyenyi commented 2 days ago

Hey @Rubanrubi @tawfikyassine,

Please make sure that you create a composable and you only import Flowbite this way:

https://flowbite.com/docs/getting-started/nuxt-js/#data-attributes

The client (aka. the browser) needs to be available so the document object is present.

Cheers, Zoltan

tawfikyassine commented 2 days ago

Hi @zoltanszogyenyi and Thanks for you reply, Im not using nuxt.js im using inertiajs SSR with laravel. I have done exactly what you mention and it is not working, i guess i will stick with the version to 2.3.0 for now :) as this version does not include the datepicker core.

in laravel ressources/js

1

in a component

2

same error

Capture d’écran 2024-07-04 120913

zoltanszogyenyi commented 2 days ago

I've updated the docs, please remove the import initFlowbite since it should be available already via the callback.