How to toggle menu on hover? #3482
-
I'm trying to create a navigation menu like this: https://www.radix-ui.com/docs/primitives/components/navigation-menu The reason that I'm not using Radix UI is that I'm doing this in Solid.js not React. Solid.js has a library named Currently, the menu can be toggled only with the "press" and "longPress" events. Is there a way to use "hover" for that? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You can control the state using the stately package. And you can use useHover to listen for hover changes. Then you can open whenever you get a hover change true. |
Beta Was this translation helpful? Give feedback.
You can control the state using the stately package. And you can use useHover to listen for hover changes. Then you can open whenever you get a hover change true.
A word of caution. Make sure you also open for press and long press for accessibility. Do not rely on hover. Otherwise you'll find yourself broken on mobile.