Darkmode works everywhere in my react app, except on a headless ui combobox. I put a styled h1 in the same component and applied dark:bg-red-200
(and any other style) no problem. The combobox accept all other tailwind utilities including attibutes like hover:
but not the dark:
property.
Dialog
-component (and I assume others too) render right in the body tag (source)Dialog
(because your wrapper is also only a child to the body)I ended up using useEffect to add the dark class to the body:
useEffect(() => {
if(darkMode){
document.body.classList.add('dark')
}else{
document.body.classList.remove('dark')
}
}, [darkMode])