On Open Change
The onOpenChange
prop is used to handle the changes when a submenu is opened or closed.
Props
onOpenChange?: (open: boolean) => void
With Parameter
This example demonstrates the onOpenChange
prop with a boolean parameter. When the submenu is opened or closed, the onOpenChange
function is called with a boolean parameter indicating the new state of the submenu.
Example
/horizontal-menu/submenu/on-open-change/with-params
Toggle Dashbord Submenu to see the change
Submenu is closed
Source Code
Without Parameter
This example illustrates the onOpenChange
prop without any parameters.
Example
/horizontal-menu/submenu/on-open-change/without-params
Toggle Dashbord Submenu and Check your console
Source Code