Nav Collpase Icons
Props with types
Props | Type | Description | Default |
---|---|---|---|
closeIcon | ReactElement | Close icon when breakpoint is reached | - |
lockedIcon | ReactElement | Locked icon when menu is expanded and locked | - |
unlockedIcon | ReactElement | Unlocked icon when menu is collapsed and unlocked/hovered | - |
onClick | () => void | Callback invoked when the collapse icon is clicked | - |
onClose | () => void | Callback 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' })} />