Sidebar Menu
Renders a list of nested and collapsible menus
- Import
import { SidebarMenu } from '@smile/haring-react'; - Extends Paper
- Source View Source Code
- Package @smile/haring-react
- Storybook Storybook
Storybook Docs
Props
| Name | Type | Default | Description |
|---|---|---|---|
| collapseButtonProps | Omit<ICollapseButtonProps, 'opened> | - | Props, or function returning props for the Controlled CollapseButton component, with the exception of the opened prop |
| defaultOpenedIds | (number | string)[] | Default opened menus, using id field of IMenuItem | |
| defaultSelectedId | number | string | Default selected menu id, referencing the id field of IMenuItem in menu | |
| hasOnlyOneOpenMenu | boolean | false | Keeps only one menu per level open at once |
| menu * | IMenuItem[] | - | The IMenuItem list to be rendered |
| menuOpenValue | (number | string)[] | Controlled state of which menus are currently open, using id field of IMenuItem in menu | |
| onMenuOpen | (id: number | string, isOpened: boolean, path: (number | string)[]) => void | Callback fired when menu is opened or closed, id and path use the ids fields of IMenuItem in menu | |
| ... | - | - | extends Paper props |
IMenuItem
| Attribute | Type | Description |
|---|---|---|
| children | IMenuItem[] | Nested array of menus |
| content | ReactNode | Content shown inside the menu |
| id * | number | string | Menu id |
| label * | number | string | Menu label |
| leftIcon | ReactNode | Menu icon |