Understanding visibility with hover classes #5136
-
First Check
Example Codewith ui.row().classes('group items-center p-4 border'):
ui.label('Hover to show icons').classes('text-lg font-bold')
ui.icon('home', size='50px').classes('invisible group-hover:visible')
ui.icon('search', size='50px').classes('hidden group-hover:block')
ui.icon('settings', size='50px').classes('opacity-0 group-hover:opacity-100') DescriptionHi All, I need some help in understanding how Tailwind hover classes work with visiblity. So I read about the When I tried, I can make it work using Why does Thanks a lot, NiceGUI Version2.22.2 Python VersionPython 3.13.5 BrowserChrome Operating SystemWindows Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @Anindya088, The problem is that "group-hover:" doesn't remove the other classes like "invisible" or "hidden". On hover they conflict with the new classes "visible" or "block" and the result can be either of them. A simple workaround is to add an "important" prefix with ui.row().classes('group items-center p-4 border'):
ui.label('Hover to show icons').classes('text-lg font-bold')
ui.icon('home', size='50px').classes('invisible group-hover:!visible')
ui.icon('search', size='50px').classes('hidden group-hover:!inline')
ui.icon('settings', size='50px').classes('opacity-0 group-hover:opacity-100') (Currently this fails on 3.0.0rc1, see #5156. Hopefully we can fix it for 3.0.0.) |
Beta Was this translation helpful? Give feedback.
Hi @Anindya088,
The problem is that "group-hover:" doesn't remove the other classes like "invisible" or "hidden". On hover they conflict with the new classes "visible" or "block" and the result can be either of them.
A simple workaround is to add an "important" prefix
!
:(Currently this fails on 3.0.0rc1, see #5156. Hopefully we can fix it for …