useSwitch inside a useMenu? #4321
-
Heya folks, im comin up short trying to figure out if its at all possible to have a switch field inside a menu dropdown? My use case is essentially to have a dark theme switch that a user can press on and off in the menu without the menu closing. not entirely sure how to pass state to that specific item in the items array let alone singling one item out who's actions don't trigger a menu close. is it even possible? cheers folks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The ARIA spec doesn't allow interactive elements inside menu items. I think what you'd need to do in this case is make something that looks like a switch but isn't actually a switch, similar to an icon. Then you can use |
Beta Was this translation helpful? Give feedback.
The ARIA spec doesn't allow interactive elements inside menu items. I think what you'd need to do in this case is make something that looks like a switch but isn't actually a switch, similar to an icon. Then you can use
selectionMode
to make the items in the menu selectable, and render your fake switches instead of checkmark icons or whatever to indicate the menu item selection state.