Skip to main content

Nav Collpase Icons

Props with types

PropsTypeDescriptionDefault
closeIconReactElementClose icon when breakpoint is reached-
lockedIconReactElementLocked icon when menu is expanded and locked-
unlockedIconReactElementUnlocked icon when menu is collapsed and unlocked/hovered-
onClick() => voidCallback invoked when the collapse icon is clicked-
onClose() => voidCallback invoked when the close icon is clicked-
/vertical-menu/nav-collapse-icons

Source Code

warning

The onClick={() => console.log('clicked')} prop written below in the NavCollapseIcons component is for demo purposes only. You should write the following instead in order to update the layout according to the collapsed state.

+ import useVerticalNav from '@menu/hooks/useVerticalNav'
+ import { useSettings } from '@core/hooks/useSettings'

+ const { isCollapsed } = useVerticalNav()
+ const { updateSettings } = useSettings()

- <NavCollapseIcons onClick={() => console.log('clicked')} />
+ <NavCollapseIcons onClick={() => updateSettings({ layout: !isCollapsed ? 'collapsed' : 'vertical' })} />